Package org.apache.http.impl.nio.client
Class CloseableHttpAsyncClient
- java.lang.Object
-
- org.apache.http.impl.nio.client.CloseableHttpAsyncClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,HttpAsyncClient
- Direct Known Subclasses:
CloseableHttpPipeliningClient
@Contract(threading=SAFE) public abstract class CloseableHttpAsyncClient extends Object implements HttpAsyncClient, Closeable
Base implementation ofHttpAsyncClient
that also implementsCloseable
.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description CloseableHttpAsyncClient()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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.abstract boolean
isRunning()
abstract void
start()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.http.nio.client.HttpAsyncClient
execute
-
-
-
-
Method Detail
-
isRunning
public abstract boolean isRunning()
-
start
public abstract void start()
-
execute
public <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)
Description copied from interface:HttpAsyncClient
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.
- Specified by:
execute
in interfaceHttpAsyncClient
- 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
public 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)
Description copied from interface:HttpAsyncClient
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.
- Specified by:
execute
in interfaceHttpAsyncClient
- Parameters:
target
- the target host for the request. Implementations may acceptnull
if they can still determine a route, for example to a default target or by inspecting the request.request
- the request to executecontext
- the context to use for the execution, ornull
to use the default contextcallback
- future callback.- Returns:
- future representing pending completion of the operation.
-
execute
public 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)
Description copied from interface:HttpAsyncClient
Initiates asynchronous HTTP request execution against the given target.- Specified by:
execute
in interfaceHttpAsyncClient
- Parameters:
target
- the target host for the request. Implementations may acceptnull
if they can still determine a route, for example to a default target or by inspecting the request.request
- the request to executecallback
- future callback.- Returns:
- future representing pending completion of the operation.
-
execute
public Future<org.apache.http.HttpResponse> execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
Description copied from interface:HttpAsyncClient
Initiates asynchronous HTTP request execution.- Specified by:
execute
in interfaceHttpAsyncClient
- Parameters:
request
- the request to executecallback
- future callback.- Returns:
- future representing pending completion of the operation.
-
execute
public 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)
Description copied from interface:HttpAsyncClient
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.
- Specified by:
execute
in interfaceHttpAsyncClient
- Parameters:
request
- the request to executecontext
- HTTP contextcallback
- future callback.- Returns:
- future representing pending completion of the operation.
-
-