https://github.com/javaquery/httpclient
Java HttpClient
https://github.com/javaquery/httpclient
Last synced: 5 months ago
JSON representation
Java HttpClient
- Host: GitHub
- URL: https://github.com/javaquery/httpclient
- Owner: javaquery
- License: gpl-3.0
- Created: 2021-04-01T15:57:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-26T06:12:30.000Z (over 1 year ago)
- Last Synced: 2025-02-26T07:21:00.349Z (over 1 year ago)
- Language: Java
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaQuery HttpClient
Welcome to the JavaQuery http client
[](https://maven-badges.herokuapp.com/maven-central/com.javaquery/httpclient)
# Why http client?
The http client is created on top of Apache http client (org.apache.httpcomponents:httpclient:4.5) with the goal of providing extensive
functionality on any http request.
# Features
The http client has the following features to make your http request experience rich.
### Request handlers
Create common or request specific HttpRequestHandler (implement com.javaquery.http.handler.HttpRequestHandler) and you can add following interceptor in the request.
- `beforeRequest(HttpExecutionContext httpExecutionContext, HttpRequest httpRequest);`
- `afterResponse(HttpExecutionContext httpExecutionContext, HttpRequest httpRequest, HttpResponse httpResponse);`
- `onError(HttpExecutionContext httpExecutionContext, HttpRequest httpRequest, Exception exception);`
### Response handlers
Same as request handler, create common or request specific HttpResponseHandler(com.javaquery.http.handler.HttpResponseHandler) and you can add following action on your response.
- `R onResponse(HttpResponse httpResponse);`
- `onMaxRetryAttempted(HttpResponse httpResponse);`
### Response
- You can make other request in after response of request handler and update final response to process.
- Get response as `JSONObject` or `JSONArray` directly.
### Retry policy
Define your custom RetryPolicy for response specific status code or based on server response. Implement `RetryPolicy.RetryCondition` and `RetryPolicy.BackoffStrategy`.
### Examples
I have created working http request examples in test cases. Explore all test cases to understand how this http client works.