Interface AsyncHttpClient
- All Superinterfaces:
AutoCloseable, Closeable, io.micronaut.context.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
-
Method Summary
Modifier and TypeMethodDescriptiondefault <I> CompletionStage<io.micronaut.http.HttpResponse<io.micronaut.core.io.buffer.ByteBuffer<?>>> exchange(io.micronaut.http.HttpRequest<I> request) Perform an HTTP request for the given request object emitting the full HTTP response.default <I,O> CompletionStage <io.micronaut.http.HttpResponse<O>> exchange(io.micronaut.http.HttpRequest<I> request, @Nullable io.micronaut.core.type.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 <io.micronaut.http.HttpResponse<O>> exchange(io.micronaut.http.HttpRequest<I> request, @Nullable io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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 <io.micronaut.http.HttpResponse<O>> 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<io.micronaut.http.HttpResponse<io.micronaut.core.io.buffer.ByteBuffer<?>>> Perform an HTTP GET request for the given URI emitting the full HTTP response.default <O> CompletionStage<io.micronaut.http.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(io.micronaut.http.HttpRequest<I> request) Perform an HTTP request and convert the response body to aString.default <I,O> CompletionStage <@Nullable O> retrieve(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType) Perform an HTTP request and convert the response body to the specified type.default <I,O, E> CompletionStage <@Nullable O> retrieve(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.Argument<E> errorType) Perform an HTTP request and convert the response body to the specified type.default <I,O> CompletionStage <@Nullable O> 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.Methods inherited from interface io.micronaut.context.LifeCycle
close, isRunning, refresh, start, stop
-
Method Details
-
exchange
<I,O, CompletionStage<io.micronaut.http.HttpResponse<O>> exchangeE> (io.micronaut.http.HttpRequest<I> request, @Nullable io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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<io.micronaut.http.HttpResponse<O>> exchange(io.micronaut.http.HttpRequest<I> request, @Nullable io.micronaut.core.type.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
default <I> CompletionStage<io.micronaut.http.HttpResponse<io.micronaut.core.io.buffer.ByteBuffer<?>>> exchange(io.micronaut.http.HttpRequest<I> request) 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
default CompletionStage<io.micronaut.http.HttpResponse<io.micronaut.core.io.buffer.ByteBuffer<?>>> exchange(String uri) 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
default <O> CompletionStage<io.micronaut.http.HttpResponse<O>> exchange(String uri, Class<O> bodyType) 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
default <I,O> CompletionStage<io.micronaut.http.HttpResponse<O>> exchange(io.micronaut.http.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.- 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> (io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType, io.micronaut.core.type.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
default <I,O> CompletionStage<@Nullable O> retrieve(io.micronaut.http.HttpRequest<I> request, io.micronaut.core.type.Argument<O> bodyType) 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
default <I,O> CompletionStage<@Nullable O> retrieve(io.micronaut.http.HttpRequest<I> request, Class<O> bodyType) 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
-