public class OkClient extends Object implements HttpClient
| Constructor and Description |
|---|
OkClient(ReadonlyHttpClientConfiguration httpClientConfig)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static HttpResponse |
convertResponse(HttpRequest request,
okhttp3.Response response,
boolean hasBinaryResponse)
Converts a given OkHttp response into our internal http response model.
|
HttpRequest |
delete(StringBuilder queryUrl,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create an HTTP DELETE request with parameters.
|
HttpBodyRequest |
deleteBody(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
Object body)
Create an HTTP DELETE request with body.
|
HttpResponse |
execute(HttpRequest httpRequest,
boolean hasBinaryResponse)
Execute a given HttpRequest to get string/binary response back.
|
HttpResponse |
execute(HttpRequest httpRequest,
boolean hasBinaryResponse,
RetryConfiguration retryConfiguration)
Execute a given HttpRequest to get string/binary response back.
|
CompletableFuture<HttpResponse> |
executeAsync(HttpRequest httpRequest,
boolean hasBinaryResponse)
Execute a given HttpRequest to get string/binary response back.
|
CompletableFuture<HttpResponse> |
executeAsync(HttpRequest httpRequest,
boolean hasBinaryResponse,
RetryConfiguration retryConfiguration)
Execute a given HttpRequest to get string/binary response back.
|
HttpRequest |
get(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create a simple HTTP GET request.
|
HttpRequest |
head(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create a simple HTTP HEAD request.
|
HttpRequest |
patch(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create an HTTP PATCH request with parameters.
|
HttpBodyRequest |
patchBody(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
Object body)
Create an HTTP PATCH request with body.
|
HttpRequest |
post(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create an HTTP POST request with parameters.
|
HttpBodyRequest |
postBody(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
Object body)
Create an HTTP POST request with body.
|
HttpRequest |
put(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
List<AbstractMap.SimpleEntry<String,Object>> parameters)
Create an HTTP PUT request with parameters.
|
HttpBodyRequest |
putBody(StringBuilder queryUrlBuilder,
Headers headers,
Map<String,Object> queryParams,
Object body)
Create an HTTP PUT request with body.
|
static void |
shutdown()
Shutdown the underlying OkHttpClient instance.
|
public OkClient(ReadonlyHttpClientConfiguration httpClientConfig)
httpClientConfig - The specified http client configuration.public static void shutdown()
public CompletableFuture<HttpResponse> executeAsync(HttpRequest httpRequest, boolean hasBinaryResponse, RetryConfiguration retryConfiguration)
executeAsync in interface HttpClienthttpRequest - The given HttpRequest to execute.hasBinaryResponse - Whether the response is binary or string.retryConfiguration - The overridden retry configuration for request.public CompletableFuture<HttpResponse> executeAsync(HttpRequest httpRequest, boolean hasBinaryResponse)
executeAsync in interface HttpClienthttpRequest - The given HttpRequest to execute.hasBinaryResponse - Whether the response is binary or string.public HttpResponse execute(HttpRequest httpRequest, boolean hasBinaryResponse, RetryConfiguration retryConfiguration) throws IOException
execute in interface HttpClienthttpRequest - The given HttpRequest to execute.hasBinaryResponse - Whether the response is binary or string.retryConfiguration - The overridden retry configuration for request.IOException - exception to be thrown while converting response.public HttpResponse execute(HttpRequest httpRequest, boolean hasBinaryResponse) throws IOException
execute in interface HttpClienthttpRequest - The given HttpRequest to execute.hasBinaryResponse - Whether the response is binary or string.IOException - exception to be thrown while converting response.protected static HttpResponse convertResponse(HttpRequest request, okhttp3.Response response, boolean hasBinaryResponse) throws IOException
request - The given http request in internal format.response - The given OkHttp response.hasBinaryResponse - Whether the response is binary or string.IOException - exception to be thrown while converting response.public HttpRequest get(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
get in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpRequest head(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
head in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpRequest post(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
post in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpBodyRequest postBody(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, Object body)
postBody in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.body - The object to be sent as body after serialization.public HttpRequest put(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
put in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpBodyRequest putBody(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, Object body)
putBody in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.body - The object to be sent as body after serialization.public HttpRequest patch(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
patch in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpBodyRequest patchBody(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, Object body)
patchBody in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.body - The object to be sent as body after serialization.public HttpRequest delete(StringBuilder queryUrl, Headers headers, Map<String,Object> queryParams, List<AbstractMap.SimpleEntry<String,Object>> parameters)
delete in interface HttpClientqueryUrl - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.parameters - The form data values in a key-value map.public HttpBodyRequest deleteBody(StringBuilder queryUrlBuilder, Headers headers, Map<String,Object> queryParams, Object body)
deleteBody in interface HttpClientqueryUrlBuilder - The http url to create the HTTP Request.headers - The key-value map of all http headers to be sent.queryParams - The query parameters in a key-value map.body - The object to be sent as body after serialization.Copyright © 2022. All rights reserved.