Interface AsyncHttpClient

All Superinterfaces:
AutoCloseable, Closeable, LifeCycle<AsyncHttpClient>
All Known Implementing Classes:
DefaultAsyncOverReactiveHttpClient

public interface AsyncHttpClient extends Closeable, LifeCycle<AsyncHttpClient>
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 Details

    • exchange

      <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.
      Type Parameters:
      I - The request body type
      O - The response body type
      E - The error type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      errorType - The error type
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • 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 type
      O - The response body type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • exchange

      default <I> CompletionStage<HttpResponse<ByteBuffer<?>>> exchange(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 - The HttpRequest to execute
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • exchange

      default CompletionStage<HttpResponse<ByteBuffer<?>>> exchange(String uri)
      Perform an HTTP GET request for the given URI emitting the full HTTP response.
      Parameters:
      uri - The URI
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • exchange

      default <O> CompletionStage<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 URI
      bodyType - The body type
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • exchange

      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.
      Type Parameters:
      I - The request body type
      O - The response body type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      Returns:
      A CompletionStage that completes with the full HttpResponse
    • retrieve

      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.
      Type Parameters:
      I - The request body type
      O - The response body type
      E - The error type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      errorType - The error type
      Returns:
      A CompletionStage that completes with the converted response body
    • retrieve

      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.
      Type Parameters:
      I - The request body type
      O - The response body type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      Returns:
      A CompletionStage that completes with the converted response body
    • retrieve

      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.
      Type Parameters:
      I - The request body type
      O - The response body type
      Parameters:
      request - The HttpRequest to execute
      bodyType - The body type
      Returns:
      A CompletionStage that completes with the converted response body
    • retrieve

      default <I> CompletionStage<@Nullable String> retrieve(HttpRequest<I> request)
      Perform an HTTP request and convert the response body to a String.
      Type Parameters:
      I - The request body type
      Parameters:
      request - The HttpRequest to execute
      Returns:
      A CompletionStage that completes with the converted response body
    • retrieve

      default CompletionStage<@Nullable String> retrieve(String uri)
      Perform an HTTP GET request for the given URI and convert the response body to a String.
      Parameters:
      uri - The URI
      Returns:
      A CompletionStage that completes with the converted response body