@ThreadSafe public class CachingHttpAsyncClient extends Object implements HttpAsyncClient
Constructor and Description |
---|
CachingHttpAsyncClient() |
CachingHttpAsyncClient(org.apache.http.impl.client.cache.CacheConfig config) |
CachingHttpAsyncClient(HttpAsyncClient client) |
CachingHttpAsyncClient(HttpAsyncClient client,
org.apache.http.impl.client.cache.CacheConfig config) |
CachingHttpAsyncClient(HttpAsyncClient client,
org.apache.http.client.cache.HttpCacheStorage storage,
org.apache.http.impl.client.cache.CacheConfig config) |
CachingHttpAsyncClient(HttpAsyncClient client,
org.apache.http.client.cache.ResourceFactory resourceFactory,
org.apache.http.client.cache.HttpCacheStorage storage,
org.apache.http.impl.client.cache.CacheConfig config) |
Modifier and Type | Method and Description |
---|---|
<T> Future<T> |
execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer,
org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer,
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,
HttpContext context,
FutureCallback<T> callback)
Initiates asynchronous HTTP request execution using the given context.
|
Future<HttpResponse> |
execute(HttpHost target,
HttpRequest request,
FutureCallback<HttpResponse> callback)
Initiates asynchronous HTTP request execution against the given target.
|
Future<HttpResponse> |
execute(HttpHost target,
HttpRequest originalRequest,
HttpContext context,
FutureCallback<HttpResponse> futureCallback)
Initiates asynchronous HTTP request execution against the given target
using the given context.
|
Future<HttpResponse> |
execute(HttpUriRequest request,
FutureCallback<HttpResponse> callback)
Initiates asynchronous HTTP request execution.
|
Future<HttpResponse> |
execute(HttpUriRequest request,
HttpContext context,
FutureCallback<HttpResponse> callback)
Initiates asynchronous HTTP request execution using the given
context.
|
long |
getCacheHits()
Reports the number of times that the cache successfully responded
to an
HttpRequest without contacting the origin server. |
long |
getCacheMisses()
Reports the number of times that the cache contacted the origin
server because it had no appropriate response cached.
|
long |
getCacheUpdates()
Reports the number of times that the cache was able to satisfy
a response by revalidating an existing but stale cache entry.
|
boolean |
isSharedCache()
Reports whether this
CachingHttpClient is configured as
a shared (public) or non-shared (private) cache. |
boolean |
supportsRangeAndContentRangeHeaders()
Reports whether this
CachingHttpClient implementation
supports byte-range requests as specified by the Range
and Content-Range headers. |
public CachingHttpAsyncClient() throws org.apache.http.nio.reactor.IOReactorException
public CachingHttpAsyncClient(org.apache.http.impl.client.cache.CacheConfig config) throws org.apache.http.nio.reactor.IOReactorException
public CachingHttpAsyncClient(HttpAsyncClient client)
public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.impl.client.cache.CacheConfig config)
public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.ResourceFactory resourceFactory, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
public long getCacheHits()
HttpRequest
without contacting the origin server.public long getCacheMisses()
public long getCacheUpdates()
public Future<HttpResponse> execute(HttpHost target, HttpRequest request, FutureCallback<HttpResponse> callback)
HttpAsyncClient
execute
in interface HttpAsyncClient
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 executecallback
- future callback.public <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback)
HttpAsyncClient
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.
execute
in interface HttpAsyncClient
T
- the result type of request execution.requestProducer
- request producer callback.responseConsumer
- response consumer callaback.callback
- future callback.public <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback)
HttpAsyncClient
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.
execute
in interface HttpAsyncClient
T
- the result type of request execution.requestProducer
- request producer callback.responseConsumer
- response consumer callaback.context
- HTTP contextcallback
- future callback.public Future<HttpResponse> execute(HttpUriRequest request, FutureCallback<HttpResponse> callback)
HttpAsyncClient
execute
in interface HttpAsyncClient
request
- the request to executecallback
- future callback.public Future<HttpResponse> execute(HttpUriRequest request, HttpContext context, FutureCallback<HttpResponse> callback)
HttpAsyncClient
Please note it may be unsafe to interact with the context instance while the request is still being executed.
execute
in interface HttpAsyncClient
request
- the request to executecontext
- HTTP contextcallback
- future callback.public Future<HttpResponse> execute(HttpHost target, HttpRequest originalRequest, HttpContext context, FutureCallback<HttpResponse> futureCallback)
HttpAsyncClient
Please note it may be unsafe to interact with the context instance while the request is still being executed.
execute
in interface HttpAsyncClient
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.originalRequest
- the request to executecontext
- the context to use for the execution, or
null
to use the default contextfutureCallback
- future callback.public boolean supportsRangeAndContentRangeHeaders()
CachingHttpClient
implementation
supports byte-range requests as specified by the Range
and Content-Range
headers.true
if byte-range requests are supportedpublic boolean isSharedCache()
CachingHttpClient
is configured as
a shared (public) or non-shared (private) cache. See CacheConfig.setSharedCache(boolean)
.true
if we are behaving as a shared (public)
cacheCopyright © 2010–2015 The Apache Software Foundation. All rights reserved.