Interface AsyncHttpClient
- All Superinterfaces:
AutoCloseable, Closeable, LifeCycle<AsyncHttpClient>
- All Known Implementing Classes:
DefaultAsyncOverReactiveHttpClient
An HTTP client API that exposes asynchronous operations backed by the Java
Future
contract instead of Reactive Streams.- Since:
- 5.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptiondefault <I> CompletionStage<HttpResponse<ByteBuffer<?>>> exchange(HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response.default <I,O> CompletionStage <HttpResponse<O>> exchange(HttpRequest<I> request, @Nullable Argument<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.<I,O, E> CompletionStage <HttpResponse<O>> exchange(HttpRequest<I> request, @Nullable Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.default <I,O> CompletionStage <HttpResponse<O>> exchange(HttpRequest<I> request, Class<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.default CompletionStage<HttpResponse<ByteBuffer<?>>> Perform an HTTP GET request for the given URI emitting the full HTTP response.default <O> CompletionStage<HttpResponse<O>> Perform an HTTP GET request for the given URI emitting the full HTTP response and converting the response body to the specified type.default <I> CompletionStage<@Nullable String> retrieve(HttpRequest<I> request) Perform an HTTP request and convert the response body to aString.default <I,O> CompletionStage <@Nullable O> retrieve(HttpRequest<I> request, Argument<O> bodyType) Perform an HTTP request and convert the response body to the specified type.default <I,O, E> CompletionStage <@Nullable O> retrieve(HttpRequest<I> request, Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request and convert the response body to the specified type.default <I,O> CompletionStage <@Nullable O> retrieve(HttpRequest<I> request, Class<O> bodyType) Perform an HTTP request and convert the response body to the specified type.default CompletionStage<@Nullable String> Perform an HTTP GET request for the given URI and convert the response body to aString.
-
Method Details
-
exchange
<I,O, CompletionStage<HttpResponse<O>> exchangeE> (HttpRequest<I> request, @Nullable Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body typeE- The error type- Parameters:
request- TheHttpRequestto executebodyType- The body typeerrorType- The error type- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
exchange
default <I,O> CompletionStage<HttpResponse<O>> exchange(HttpRequest<I> request, @Nullable Argument<O> bodyType) Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
exchange
Perform an HTTP request for the given request object emitting the full HTTP response.- Type Parameters:
I- The request body type- Parameters:
request- TheHttpRequestto execute- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
exchange
Perform an HTTP GET request for the given URI emitting the full HTTP response.- Parameters:
uri- The URI- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
exchange
Perform an HTTP GET request for the given URI emitting the full HTTP response and converting the response body to the specified type.- Type Parameters:
O- The response body type- Parameters:
uri- The URIbodyType- The body type- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
exchange
Perform an HTTP request for the given request object emitting the full HTTP response and converting the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A
CompletionStagethat completes with the fullHttpResponse
-
retrieve
default <I,O, CompletionStage<@Nullable O> retrieveE> (HttpRequest<I> request, Argument<O> bodyType, Argument<E> errorType) Perform an HTTP request and convert the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body typeE- The error type- Parameters:
request- TheHttpRequestto executebodyType- The body typeerrorType- The error type- Returns:
- A
CompletionStagethat completes with the converted response body
-
retrieve
Perform an HTTP request and convert the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A
CompletionStagethat completes with the converted response body
-
retrieve
Perform an HTTP request and convert the response body to the specified type.- Type Parameters:
I- The request body typeO- The response body type- Parameters:
request- TheHttpRequestto executebodyType- The body type- Returns:
- A
CompletionStagethat completes with the converted response body
-
retrieve
Perform an HTTP request and convert the response body to aString.- Type Parameters:
I- The request body type- Parameters:
request- TheHttpRequestto execute- Returns:
- A
CompletionStagethat completes with the converted response body
-
retrieve
Perform an HTTP GET request for the given URI and convert the response body to aString.- Parameters:
uri- The URI- Returns:
- A
CompletionStagethat completes with the converted response body
-