HttpComponentsClientHttpRequestFactory
@Deprecated public class CommonsClientHttpRequestFactory extends java.lang.Object implements ClientHttpRequestFactory, DisposableBean
ClientHttpRequestFactory
implementation that uses
Jakarta Commons HttpClient to create requests.
Allows to use a pre-configured HttpClient
instance -
potentially with authentication, HTTP connection pooling, etc.
SimpleClientHttpRequestFactory
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_READ_TIMEOUT_MILLISECONDS
Deprecated.
|
private HttpClient |
httpClient
Deprecated.
|
Constructor and Description |
---|
CommonsClientHttpRequestFactory()
Deprecated.
Create a new instance of the
CommonsHttpRequestFactory with a default
HttpClient that uses a default MultiThreadedHttpConnectionManager . |
CommonsClientHttpRequestFactory(HttpClient httpClient)
Deprecated.
Create a new instance of the
CommonsHttpRequestFactory with the given
HttpClient instance. |
Modifier and Type | Method and Description |
---|---|
protected HttpMethodBase |
createCommonsHttpMethod(HttpMethod httpMethod,
java.lang.String uri)
Deprecated.
Create a Commons HttpMethodBase object for the given HTTP method
and URI specification.
|
ClientHttpRequest |
createRequest(java.net.URI uri,
HttpMethod httpMethod)
Deprecated.
Create a new
ClientHttpRequest for the specified URI and HTTP method. |
void |
destroy()
Deprecated.
Shutdown hook that closes the underlying
HttpConnectionManager 's
connection pool, if any. |
HttpClient |
getHttpClient()
Deprecated.
Return the
HttpClient used by this factory. |
protected void |
postProcessCommonsHttpMethod(HttpMethodBase httpMethod)
Deprecated.
Template method that allows for manipulating the
org.apache.commons.httpclient.HttpMethodBase
before it is returned as part of a CommonsClientHttpRequest . |
void |
setConnectTimeout(int timeout)
Deprecated.
Set the connection timeout for the underlying HttpClient.
|
void |
setHttpClient(HttpClient httpClient)
Deprecated.
Set the
HttpClient used by this factory. |
void |
setReadTimeout(int timeout)
Deprecated.
Set the socket read timeout for the underlying HttpClient.
|
private static final int DEFAULT_READ_TIMEOUT_MILLISECONDS
private HttpClient httpClient
public CommonsClientHttpRequestFactory()
CommonsHttpRequestFactory
with a default
HttpClient
that uses a default MultiThreadedHttpConnectionManager
.public CommonsClientHttpRequestFactory(HttpClient httpClient)
CommonsHttpRequestFactory
with the given
HttpClient
instance.httpClient
- the HttpClient instance to use for this factorypublic void setHttpClient(HttpClient httpClient)
HttpClient
used by this factory.public HttpClient getHttpClient()
HttpClient
used by this factory.public void setConnectTimeout(int timeout)
timeout
- the timeout value in millisecondsorg.apache.commons.httpclient.params.HttpConnectionManagerParams#setConnectionTimeout(int)
public void setReadTimeout(int timeout)
timeout
- the timeout value in millisecondsorg.apache.commons.httpclient.params.HttpConnectionManagerParams#setSoTimeout(int)
public ClientHttpRequest createRequest(java.net.URI uri, HttpMethod httpMethod) throws java.io.IOException
ClientHttpRequestFactory
ClientHttpRequest
for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.
createRequest
in interface ClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executejava.io.IOException
- in case of I/O errorsprotected HttpMethodBase createCommonsHttpMethod(HttpMethod httpMethod, java.lang.String uri)
httpMethod
- the HTTP methoduri
- the URIprotected void postProcessCommonsHttpMethod(HttpMethodBase httpMethod)
org.apache.commons.httpclient.HttpMethodBase
before it is returned as part of a CommonsClientHttpRequest
.
The default implementation is empty.
httpMethod
- the Commons HTTP method object to processpublic void destroy()
HttpConnectionManager
's
connection pool, if any.destroy
in interface DisposableBean