public class HttpComponentsAsyncClientHttpRequestFactory extends HttpComponentsClientHttpRequestFactory implements AsyncClientHttpRequestFactory, org.springframework.beans.factory.InitializingBean
HttpComponentsClientHttpRequestFactory. Uses
Apache HttpComponents
HttpAsyncClient 4.0 to create requests.HttpAsyncClient| Constructor and Description |
|---|
HttpComponentsAsyncClientHttpRequestFactory()
Create a new instance of the
HttpComponentsAsyncClientHttpRequestFactory
with a default HttpAsyncClient and HttpClient. |
HttpComponentsAsyncClientHttpRequestFactory(org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
Create a new instance of the
HttpComponentsAsyncClientHttpRequestFactory
with the given HttpAsyncClient instance and a default HttpClient. |
HttpComponentsAsyncClientHttpRequestFactory(org.apache.http.impl.client.CloseableHttpClient httpClient,
org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
Create a new instance of the
HttpComponentsAsyncClientHttpRequestFactory
with the given HttpClient and HttpAsyncClient instances. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
AsyncClientHttpRequest |
createAsyncRequest(URI uri,
HttpMethod httpMethod)
Create a new asynchronous
AsyncClientHttpRequest for the specified URI
and HTTP method. |
void |
destroy()
Shutdown hook that closes the underlying
ClientConnectionManager's
connection pool, if any. |
org.apache.http.impl.nio.client.CloseableHttpAsyncClient |
getHttpAsyncClient()
Return the
HttpClient used for
asynchronous execution. |
void |
setHttpAsyncClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
Set the
HttpClient used for
asynchronous execution. |
createHttpContext, createHttpUriRequest, createRequest, getHttpClient, postProcessHttpRequest, setBufferRequestBody, setConnectTimeout, setHttpClient, setReadTimeoutpublic HttpComponentsAsyncClientHttpRequestFactory()
HttpComponentsAsyncClientHttpRequestFactory
with a default HttpAsyncClient and HttpClient.public HttpComponentsAsyncClientHttpRequestFactory(org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
HttpComponentsAsyncClientHttpRequestFactory
with the given HttpAsyncClient instance and a default HttpClient.httpAsyncClient - the HttpAsyncClient instance to use for this request factorypublic HttpComponentsAsyncClientHttpRequestFactory(org.apache.http.impl.client.CloseableHttpClient httpClient,
org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
HttpComponentsAsyncClientHttpRequestFactory
with the given HttpClient and HttpAsyncClient instances.httpClient - the HttpClient instance to use for this request factoryhttpAsyncClient - the HttpAsyncClient instance to use for this request factorypublic void setHttpAsyncClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient httpAsyncClient)
HttpClient used for
asynchronous execution.public org.apache.http.impl.nio.client.CloseableHttpAsyncClient getHttpAsyncClient()
HttpClient used for
asynchronous execution.public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException
AsyncClientHttpRequestFactoryAsyncClientHttpRequest for the specified URI
and HTTP method.
The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync().
createAsyncRequest in interface AsyncClientHttpRequestFactoryuri - the URI to create a request forhttpMethod - the HTTP method to executeIOException - in case of I/O errorspublic void destroy()
throws Exception
HttpComponentsClientHttpRequestFactoryClientConnectionManager's
connection pool, if any.destroy in interface org.springframework.beans.factory.DisposableBeandestroy in class HttpComponentsClientHttpRequestFactoryException