RapidRequest is a simple and easy to use HTTP request library for Java. It is designed to make HTTP requests with minimal code and adequate flexibility.
- Logging
- Response Object
- Synchronous Requests
- Asynchronous Requests
- Class Parsing
- Better Exception Handling
- File Handling
- Threading?
View the Maven Repository here
Add the following dependency to your pom.xml file:
<dependency>
<groupId>dev.dubsky</groupId>
<artifactId>rapidrequest</artifactId>
<version>1.2</version>
</dependency>or if you are using Gradle, add the following to your build.gradle file:
implementation 'dev.dubsky:rapidrequest:1.2'Blocking (synchronous) request:
RapidResponse response = new SyncRequest()
.setUrl("https://type.fit/api/quotes")
.setMethod(HttpMethod.GET)
.expect(ContentType.JSON) // Optional
.addHeader("Header", "Header-Value") // Optional
.addHeader("Another-Header", "Another-Value") // Optional
.call();Asynchronous request:
RapidResponse response = new AsyncRequest()
.setUrl("https://type.fit/api/quotes")
.setMethod(HttpMethod.GET)
.expect(ContentType.JSON) // Optional
.addHeader("Header", "Header-Value") // Optional
.addHeader("Another-Header", "Another-Value") // Optional
.call();Asynchronous request with blocking:
RapidResponse response = new AsyncRequest()
.setUrl("https://type.fit/api/quotes")
.setMethod(HttpMethod.GET)
.expect(ContentType.JSON) // Optional
.addHeader("Header", "Header-Value") // Optional
.addHeader("Another-Header", "Another-Value") // Optional
.call();
response.waitForCompletion(); // Blocks until the request is completeRapidResponse{
statusCode=200,
response='[
{
"text": "Genius is one percent inspiration and ninety-nine percent perspiration.",
"author": "Thomas Edison, type.fit"
},
...
]',
request=Request{
method=GET,
url='https://type.fit/api/quotes',
body='null',
contentType=JSON,
headers=[User-Agent=Java 21 HttpClient],
returnType=JSON
}
}- v1.1 - 27-02-2024
- v1.2 - 29-02-2024
Latest: