Interface HttpAsyncClient

All Known Subinterfaces:
HttpPipeliningClient
All Known Implementing Classes:
AbstractHttpAsyncClient, CachingHttpAsyncClient, CloseableHttpAsyncClient, CloseableHttpAsyncClientBase, CloseableHttpPipeliningClient, DefaultHttpAsyncClient, InternalHttpAsyncClient, MinimalHttpAsyncClient

public interface HttpAsyncClient
This interface represents only the most basic contract for HTTP request execution. It imposes no restrictions or particular details on the request execution process and leaves the specifics of state management, authentication and redirect handling up to individual implementations.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution using the given context.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution against the given target.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution against the given target using the given context.
    <T> Future<T>
    execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.concurrent.FutureCallback<T> callback)
    Initiates asynchronous HTTP request execution using the default context.
    <T> Future<T>
    execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
    Initiates asynchronous HTTP request execution using the given context.
  • Method Details

    • execute

      <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
      Initiates asynchronous HTTP request execution using the given context.

      The request producer passed to this method will be used to generate a request message and stream out its content without buffering it in memory. The response consumer passed to this method will be used to process a response message without buffering its content in memory.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Type Parameters:
      T - the result type of request execution.
      Parameters:
      requestProducer - request producer callback.
      responseConsumer - response consumer callaback.
      context - HTTP context
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.concurrent.FutureCallback<T> callback)
      Initiates asynchronous HTTP request execution using the default context.

      The request producer passed to this method will be used to generate a request message and stream out its content without buffering it in memory. The response consumer passed to this method will be used to process a response message without buffering its content in memory.

      Type Parameters:
      T - the result type of request execution.
      Parameters:
      requestProducer - request producer callback.
      responseConsumer - response consumer callaback.
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      Future<org.apache.http.HttpResponse> execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Initiates asynchronous HTTP request execution against the given target using the given context.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Parameters:
      target - the target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
      request - the request to execute
      context - the context to use for the execution, or null to use the default context
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      Future<org.apache.http.HttpResponse> execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Initiates asynchronous HTTP request execution against the given target.
      Parameters:
      target - the target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
      request - the request to execute
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      Future<org.apache.http.HttpResponse> execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Initiates asynchronous HTTP request execution using the given context.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Parameters:
      request - the request to execute
      context - HTTP context
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      Future<org.apache.http.HttpResponse> execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Initiates asynchronous HTTP request execution.
      Parameters:
      request - the request to execute
      callback - future callback.
      Returns:
      future representing pending completion of the operation.