| Package | Description |
|---|---|
| kong.unirest | |
| kong.unirest.apache |
| Modifier and Type | Class and Description |
|---|---|
class |
BasicResponse<T> |
class |
ByteResponse |
class |
FailedResponse<T>
A failed response you COULD return if you want to live in a house of lies.
|
class |
FileResponse |
class |
JsonResponse |
class |
StringResponse |
| Modifier and Type | Method and Description |
|---|---|
HttpResponse<byte[]> |
HttpRequest.asBytes()
Executes the request and returns the response with the body mapped into a byte[]
|
HttpResponse<Empty> |
HttpRequest.asEmpty()
Executes the request and returns the response without parsing the body
|
HttpResponse<File> |
HttpRequest.asFile(String path,
CopyOption... copyOptions)
Executes the request and writes the contents into a file
|
HttpResponse<JsonNode> |
HttpRequest.asJson()
Executes the request and returns the response with the body mapped into a JsonNode
|
<T> HttpResponse<T> |
HttpRequest.asObject(Class<? extends T> responseClass)
Executes the request and returns the response with the body mapped into T by a configured ObjectMapper
|
<T> HttpResponse<T> |
HttpRequest.asObject(Function<RawResponse,T> function)
Execute the request and pass the raw response to a function for mapping.
|
<T> HttpResponse<T> |
HttpRequest.asObject(GenericType<T> genericType)
Executes the request and returns the response with the body mapped into T by a configured ObjectMapper
|
HttpResponse<String> |
HttpRequest.asString()
Executes the request and returns the response with the body mapped into a String
|
<T> HttpResponse |
Cache.get(Cache.Key key,
Supplier<HttpResponse<T>> fetcher)
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
|
<E> HttpResponse<T> |
HttpResponse.ifFailure(Class<? extends E> errorClass,
Consumer<HttpResponse<E>> consumer)
If the response was NOT a 200-series response or a mapping exception happened.
|
<E> HttpResponse<T> |
FailedResponse.ifFailure(Class<? extends E> errorClass,
Consumer<HttpResponse<E>> consumer) |
HttpResponse<T> |
HttpResponse.ifFailure(Consumer<HttpResponse<T>> consumer)
If the response was NOT a 200-series response or a mapping exception happened.
|
HttpResponse<T> |
FailedResponse.ifFailure(Consumer<HttpResponse<T>> consumer) |
HttpResponse<T> |
HttpResponse.ifSuccess(Consumer<HttpResponse<T>> consumer)
If the response was a 200-series response.
|
HttpResponse<T> |
FailedResponse.ifSuccess(Consumer<HttpResponse<T>> consumer) |
<V> HttpResponse<V> |
HttpResponse.map(Function<T,V> func)
Map the Response into another response with a different body
|
<V> HttpResponse<V> |
FailedResponse.map(Function<T,V> func) |
default HttpResponse<?> |
Interceptor.onFail(Exception e,
HttpRequestSummary request,
Config config)
Called in the case of a total failure.
|
<T> HttpResponse<T> |
Client.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer)
Deprecated.
use the version with the resultType
|
default <T> HttpResponse<T> |
Client.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
Class<?> resultType)
Make a request
|
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<HttpResponse<byte[]>> |
HttpRequest.asBytesAsync()
Executes the request asynchronously and returns the response with the body mapped into a byte[]
|
CompletableFuture<HttpResponse<byte[]>> |
HttpRequest.asBytesAsync(Callback<byte[]> callback)
Executes the request asynchronously and returns the response with the body mapped into a byte[]
|
CompletableFuture<HttpResponse<Empty>> |
HttpRequest.asEmptyAsync()
Executes the request asynchronously and returns the response without parsing the body
|
CompletableFuture<HttpResponse<Empty>> |
HttpRequest.asEmptyAsync(Callback<Empty> callback)
Executes the request asynchronously and returns a empty response which is passed to a callback
|
CompletableFuture<HttpResponse<File>> |
HttpRequest.asFileAsync(String path,
Callback<File> callback,
CopyOption... copyOptions)
asynchronously executes the request and writes the contents into a file
|
CompletableFuture<HttpResponse<File>> |
HttpRequest.asFileAsync(String path,
CopyOption... copyOptions)
asynchronously executes the request and writes the contents into a file
|
CompletableFuture<HttpResponse<JsonNode>> |
HttpRequest.asJsonAsync()
Executes the request asynchronously and returns the response with the body mapped into a JsonNode
|
CompletableFuture<HttpResponse<JsonNode>> |
HttpRequest.asJsonAsync(Callback<JsonNode> callback)
Executes the request asynchronously and returns the response with the body mapped into a JsonNode
|
<T> CompletableFuture<HttpResponse<T>> |
HttpRequest.asObjectAsync(Class<? extends T> responseClass)
Executes the request asynchronously and returns response with the body mapped into T by a configured ObjectMapper
|
<T> CompletableFuture<HttpResponse<T>> |
HttpRequest.asObjectAsync(Class<? extends T> responseClass,
Callback<T> callback)
Executes the request asynchronously, mapping to a type via the configured object mapper and then passed to a callback handler.
|
<T> CompletableFuture<HttpResponse<T>> |
HttpRequest.asObjectAsync(Function<RawResponse,T> function)
Executes the request asynchronously, and pass the raw response to a function for mapping.
|
<T> CompletableFuture<HttpResponse<T>> |
HttpRequest.asObjectAsync(GenericType<T> genericType)
Executes the request asynchronously, and use a GenericType with the ObjectMapper
|
<T> CompletableFuture<HttpResponse<T>> |
HttpRequest.asObjectAsync(GenericType<T> genericType,
Callback<T> callback)
Executes the request asynchronously, and use a GenericType with the ObjectMapper
|
CompletableFuture<HttpResponse<String>> |
HttpRequest.asStringAsync()
Executes the request asynchronously and returns the response with the body mapped into a String
|
CompletableFuture<HttpResponse<String>> |
HttpRequest.asStringAsync(Callback<String> callback)
Executes the request asynchronously and returns the response with the body mapped into a String
|
Consumer<HttpResponse<?>> |
Config.getErrorHandler()
Deprecated.
use interceptors instead
|
<T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback)
Deprecated.
use the version with the resultType
|
default <T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback,
Class<?> resultType)
Make a Async request
|
| Modifier and Type | Method and Description |
|---|---|
void |
Callback.completed(HttpResponse<T> response) |
default void |
Interceptor.onResponse(HttpResponse<?> response,
HttpRequestSummary request,
Config config)
Called just after the request.
|
| Modifier and Type | Method and Description |
|---|---|
<T> PagedList<T> |
HttpRequest.asPaged(Function<HttpRequest,HttpResponse> mappingFunction,
Function<HttpResponse<T>,String> linkExtractor)
Allows for following paging links common in many APIs.
|
<T> PagedList<T> |
HttpRequest.asPaged(Function<HttpRequest,HttpResponse> mappingFunction,
Function<HttpResponse<T>,String> linkExtractor)
Allows for following paging links common in many APIs.
|
Config |
Config.errorHandler(Consumer<HttpResponse<?>> consumer)
Deprecated.
this is merging with the interceptor concept. see interceptor(Interceptor value)
|
<T> HttpResponse |
Cache.get(Cache.Key key,
Supplier<HttpResponse<T>> fetcher)
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
|
<T> CompletableFuture |
Cache.getAsync(Cache.Key key,
Supplier<CompletableFuture<HttpResponse<T>>> fetcher)
Returns the cached HttpResponse for a key or uses the Supplier to fetch the response
|
<E> HttpResponse<T> |
HttpResponse.ifFailure(Class<? extends E> errorClass,
Consumer<HttpResponse<E>> consumer)
If the response was NOT a 200-series response or a mapping exception happened.
|
<E> HttpResponse<T> |
FailedResponse.ifFailure(Class<? extends E> errorClass,
Consumer<HttpResponse<E>> consumer) |
HttpResponse<T> |
HttpResponse.ifFailure(Consumer<HttpResponse<T>> consumer)
If the response was NOT a 200-series response or a mapping exception happened.
|
PagedList<T> |
PagedList.ifFailure(Consumer<HttpResponse<T>> consumer)
For each failed response if the response was NOT a 200-series response or a mapping exception happened.
|
HttpResponse<T> |
FailedResponse.ifFailure(Consumer<HttpResponse<T>> consumer) |
HttpResponse<T> |
HttpResponse.ifSuccess(Consumer<HttpResponse<T>> consumer)
If the response was a 200-series response.
|
PagedList<T> |
PagedList.ifSuccess(Consumer<HttpResponse<T>> consumer)
For each successful response If the response was a 200-series response.
|
HttpResponse<T> |
FailedResponse.ifSuccess(Consumer<HttpResponse<T>> consumer) |
<T> HttpResponse<T> |
Client.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer)
Deprecated.
use the version with the resultType
|
default <T> HttpResponse<T> |
Client.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
Class<?> resultType)
Make a request
|
<T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback)
Deprecated.
use the version with the resultType
|
<T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback)
Deprecated.
use the version with the resultType
|
default <T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback,
Class<?> resultType)
Make a Async request
|
default <T> CompletableFuture<HttpResponse<T>> |
AsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback,
Class<?> resultType)
Make a Async request
|
| Modifier and Type | Method and Description |
|---|---|
<T> HttpResponse<T> |
ApacheClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer) |
| Modifier and Type | Method and Description |
|---|---|
<T> CompletableFuture<HttpResponse<T>> |
ApacheAsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback) |
| Modifier and Type | Method and Description |
|---|---|
<T> HttpResponse<T> |
ApacheClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer) |
<T> CompletableFuture<HttpResponse<T>> |
ApacheAsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback) |
<T> CompletableFuture<HttpResponse<T>> |
ApacheAsyncClient.request(HttpRequest request,
Function<RawResponse,HttpResponse<T>> transformer,
CompletableFuture<HttpResponse<T>> callback) |
Copyright © 2023. All rights reserved.