|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.http.client.HttpComponentsClientHttpRequestFactory
public class HttpComponentsClientHttpRequestFactory
ClientHttpRequestFactory implementation that uses
Apache HttpComponents HttpClient
to create requests.
Allows to use a pre-configured HttpClient instance -
potentially with authentication, HTTP connection pooling, etc.
| Constructor Summary | |
|---|---|
HttpComponentsClientHttpRequestFactory()
Create a new instance of the HttpComponentsClientHttpRequestFactory with a default HttpClient that uses a default ThreadSafeClientConnManager. |
|
HttpComponentsClientHttpRequestFactory(org.apache.http.client.HttpClient httpClient)
Create a new instance of the HttpComponentsClientHttpRequestFactory with the given HttpClient instance. |
|
| Method Summary | |
|---|---|
protected org.apache.http.protocol.HttpContext |
createHttpContext(HttpMethod httpMethod,
URI uri)
Template methods that creates a HttpContext for the given HTTP method and URI. |
protected org.apache.http.client.methods.HttpUriRequest |
createHttpUriRequest(HttpMethod httpMethod,
URI uri)
Create a Commons HttpMethodBase object for the given HTTP method and URI specification. |
ClientHttpRequest |
createRequest(URI uri,
HttpMethod httpMethod)
Create a new ClientHttpRequest for the specified URI and HTTP method. |
void |
destroy()
Shutdown hook that closes the underlying ClientConnectionManager's
connection pool, if any. |
org.apache.http.client.HttpClient |
getHttpClient()
Return the HttpClient used by this factory. |
protected void |
postProcessHttpRequest(org.apache.http.client.methods.HttpUriRequest request)
Template method that allows for manipulating the HttpUriRequest before it is
returned as part of a HttpComponentsClientHttpRequest. |
void |
setConnectTimeout(int timeout)
Set the connection timeout for the underlying HttpClient. |
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Set the HttpClient used by this factory. |
void |
setReadTimeout(int timeout)
Set the socket read timeout for the underlying HttpClient. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpComponentsClientHttpRequestFactory()
HttpClient that uses a default ThreadSafeClientConnManager.
public HttpComponentsClientHttpRequestFactory(org.apache.http.client.HttpClient httpClient)
HttpClient instance.
httpClient - the HttpClient instance to use for this request factory| Method Detail |
|---|
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
HttpClient used by this factory.
public org.apache.http.client.HttpClient getHttpClient()
HttpClient used by this factory.
public void setConnectTimeout(int timeout)
timeout - the timeout value in millisecondspublic void setReadTimeout(int timeout)
timeout - the timeout value in milliseconds
public ClientHttpRequest createRequest(URI uri,
HttpMethod httpMethod)
throws IOException
ClientHttpRequestFactoryClientHttpRequest for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute().
createRequest in interface ClientHttpRequestFactoryuri - the URI to create a request forhttpMethod - the HTTP method to execute
IOException - in case of I/O errors
protected org.apache.http.client.methods.HttpUriRequest createHttpUriRequest(HttpMethod httpMethod,
URI uri)
httpMethod - the HTTP methoduri - the URI
protected void postProcessHttpRequest(org.apache.http.client.methods.HttpUriRequest request)
HttpUriRequest before it is
returned as part of a HttpComponentsClientHttpRequest.
The default implementation is empty.
request - the request to process
protected org.apache.http.protocol.HttpContext createHttpContext(HttpMethod httpMethod,
URI uri)
HttpContext for the given HTTP method and URI.
The default implementation returns null.
httpMethod - the HTTP methoduri - the URI
public void destroy()
ClientConnectionManager's
connection pool, if any.
destroy in interface DisposableBean
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||