public class DefaultAsyncHttpClient extends java.lang.Object implements AsyncHttpClient
AsyncHttpClient
.Constructor and Description |
---|
DefaultAsyncHttpClient()
Create a new HTTP Asynchronous Client using the default
DefaultAsyncHttpClientConfig configuration. |
DefaultAsyncHttpClient(AsyncHttpClientConfig config)
Create a new HTTP Asynchronous Client using the specified
DefaultAsyncHttpClientConfig configuration. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ListenableFuture<Response> |
executeRequest(Request request)
Execute an HTTP request.
|
<T> ListenableFuture<T> |
executeRequest(Request request,
AsyncHandler<T> handler)
Execute an HTTP request.
|
ListenableFuture<Response> |
executeRequest(RequestBuilder requestBuilder)
Execute an HTTP request.
|
<T> ListenableFuture<T> |
executeRequest(RequestBuilder requestBuilder,
AsyncHandler<T> handler)
Execute an HTTP request.
|
void |
flushChannelPoolPartitions(java.util.function.Predicate<java.lang.Object> predicate)
Flush ChannelPool partitions based on a predicate
|
ChannelPool |
getChannelPool() |
ClientStats |
getClientStats()
Return details about pooled connections.
|
AsyncHttpClientConfig |
getConfig()
Return the config associated to this client.
|
io.netty.channel.EventLoopGroup |
getEventLoopGroup() |
boolean |
isClosed()
Return true if closed
|
BoundRequestBuilder |
prepare(java.lang.String method,
java.lang.String url)
Prepare an HTTP client request.
|
BoundRequestBuilder |
prepareConnect(java.lang.String url)
Prepare an HTTP client CONNECT request.
|
BoundRequestBuilder |
prepareDelete(java.lang.String url)
Prepare an HTTP client DELETE request.
|
BoundRequestBuilder |
prepareGet(java.lang.String url)
Prepare an HTTP client GET request.
|
BoundRequestBuilder |
prepareHead(java.lang.String url)
Prepare an HTTP client HEAD request.
|
BoundRequestBuilder |
prepareOptions(java.lang.String url)
Prepare an HTTP client OPTIONS request.
|
BoundRequestBuilder |
preparePatch(java.lang.String url)
Prepare an HTTP client PATCH request.
|
BoundRequestBuilder |
preparePost(java.lang.String url)
Prepare an HTTP client POST request.
|
BoundRequestBuilder |
preparePut(java.lang.String url)
Prepare an HTTP client PUT request.
|
BoundRequestBuilder |
prepareRequest(Request request)
Construct a
RequestBuilder using a Request |
BoundRequestBuilder |
prepareRequest(RequestBuilder requestBuilder)
Construct a
RequestBuilder using a RequestBuilder |
BoundRequestBuilder |
prepareTrace(java.lang.String url)
Prepare an HTTP client TRACE request.
|
protected BoundRequestBuilder |
requestBuilder(Request prototype) |
protected BoundRequestBuilder |
requestBuilder(java.lang.String method,
java.lang.String url) |
DefaultAsyncHttpClient |
setSignatureCalculator(SignatureCalculator signatureCalculator)
Set default signature calculator to use for requests built by this client instance
|
public DefaultAsyncHttpClient()
DefaultAsyncHttpClientConfig
configuration. The default
AsyncHttpClient
that will be used will be based on the classpath
configuration.
If none of those providers are found, then the engine will throw an IllegalStateException.
public DefaultAsyncHttpClient(AsyncHttpClientConfig config)
DefaultAsyncHttpClientConfig
configuration. This configuration
will be passed to the default AsyncHttpClient
that will be
selected based on the classpath configuration.config
- a DefaultAsyncHttpClientConfig
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public boolean isClosed()
AsyncHttpClient
isClosed
in interface AsyncHttpClient
public DefaultAsyncHttpClient setSignatureCalculator(SignatureCalculator signatureCalculator)
AsyncHttpClient
setSignatureCalculator
in interface AsyncHttpClient
signatureCalculator
- a signature calculatorRequestBuilder
public BoundRequestBuilder prepare(java.lang.String method, java.lang.String url)
AsyncHttpClient
prepare
in interface AsyncHttpClient
method
- HTTP request method type. MUST BE in upper caseurl
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareGet(java.lang.String url)
AsyncHttpClient
prepareGet
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareConnect(java.lang.String url)
AsyncHttpClient
prepareConnect
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareOptions(java.lang.String url)
AsyncHttpClient
prepareOptions
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareHead(java.lang.String url)
AsyncHttpClient
prepareHead
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder preparePost(java.lang.String url)
AsyncHttpClient
preparePost
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder preparePut(java.lang.String url)
AsyncHttpClient
preparePut
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareDelete(java.lang.String url)
AsyncHttpClient
prepareDelete
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder preparePatch(java.lang.String url)
AsyncHttpClient
preparePatch
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareTrace(java.lang.String url)
AsyncHttpClient
prepareTrace
in interface AsyncHttpClient
url
- A well formed URL.RequestBuilder
public BoundRequestBuilder prepareRequest(Request request)
AsyncHttpClient
RequestBuilder
using a Request
prepareRequest
in interface AsyncHttpClient
request
- a Request
RequestBuilder
public BoundRequestBuilder prepareRequest(RequestBuilder requestBuilder)
AsyncHttpClient
RequestBuilder
using a RequestBuilder
prepareRequest
in interface AsyncHttpClient
requestBuilder
- a RequestBuilder
RequestBuilder
public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler)
AsyncHttpClient
executeRequest
in interface AsyncHttpClient
T
- Type of the value that will be returned by the associated Future
request
- Request
handler
- an instance of AsyncHandler
Future
of type Tpublic <T> ListenableFuture<T> executeRequest(RequestBuilder requestBuilder, AsyncHandler<T> handler)
AsyncHttpClient
executeRequest
in interface AsyncHttpClient
T
- Type of the value that will be returned by the associated Future
requestBuilder
- RequestBuilder
handler
- an instance of AsyncHandler
Future
of type Tpublic ListenableFuture<Response> executeRequest(Request request)
AsyncHttpClient
executeRequest
in interface AsyncHttpClient
request
- Request
Future
of type Responsepublic ListenableFuture<Response> executeRequest(RequestBuilder requestBuilder)
AsyncHttpClient
executeRequest
in interface AsyncHttpClient
requestBuilder
- RequestBuilder
Future
of type Responsepublic ChannelPool getChannelPool()
public io.netty.channel.EventLoopGroup getEventLoopGroup()
public ClientStats getClientStats()
AsyncHttpClient
getClientStats
in interface AsyncHttpClient
ClientStats
public void flushChannelPoolPartitions(java.util.function.Predicate<java.lang.Object> predicate)
AsyncHttpClient
flushChannelPoolPartitions
in interface AsyncHttpClient
predicate
- the predicateprotected BoundRequestBuilder requestBuilder(java.lang.String method, java.lang.String url)
protected BoundRequestBuilder requestBuilder(Request prototype)
public AsyncHttpClientConfig getConfig()
AsyncHttpClient
getConfig
in interface AsyncHttpClient
Copyright © 2019. All Rights Reserved.