HttpComponentsMessageSender@Deprecated public class CommonsHttpMessageSender extends AbstractHttpWebServiceMessageSender implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
WebServiceMessageSender implementation that uses
Jakarta Commons HttpClient to execute POST requests.
Allows to use a preconfigured HttpClient instance, potentially with authentication, HTTP connection pooling, etc.
Authentication can also be set by injecting a Credentials instance (such as the
UsernamePasswordCredentials).
HttpUrlConnectionMessageSender,
HttpClient,
setCredentials(Credentials)logger| Constructor and Description |
|---|
CommonsHttpMessageSender()
Deprecated.
Create a new instance of the
CommonsHttpMessageSender with a default HttpClient that uses a default
MultiThreadedHttpConnectionManager. |
CommonsHttpMessageSender(org.apache.commons.httpclient.HttpClient httpClient)
Deprecated.
Create a new instance of the
CommonsHttpMessageSender with the given HttpClient instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
WebServiceConnection |
createConnection(URI uri)
Deprecated.
Create a new
WebServiceConnection to the specified URI. |
void |
destroy()
Deprecated.
|
org.apache.commons.httpclient.auth.AuthScope |
getAuthScope()
Deprecated.
Returns the authentication scope to be used.
|
org.apache.commons.httpclient.Credentials |
getCredentials()
Deprecated.
Returns the credentials to be used.
|
org.apache.commons.httpclient.HttpClient |
getHttpClient()
Deprecated.
Returns the
HttpClient used by this message sender. |
void |
setAuthScope(org.apache.commons.httpclient.auth.AuthScope authScope)
Deprecated.
Sets the authentication scope to be used.
|
void |
setConnectionTimeout(int timeout)
Deprecated.
Sets the timeout until a connection is etablished.
|
void |
setCredentials(org.apache.commons.httpclient.Credentials credentials)
Deprecated.
Sets the credentials to be used.
|
void |
setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
Deprecated.
Set the
HttpClient used by this message sender. |
void |
setMaxConnectionsPerHost(Map<String,String> maxConnectionsPerHost)
Deprecated.
Sets the maximum number of connections per host for the underlying HttpClient.
|
void |
setMaxTotalConnections(int maxTotalConnections)
Deprecated.
Sets the maximum number of connections allowed for the underlying HttpClient.
|
void |
setReadTimeout(int timeout)
Deprecated.
Set the socket read timeout for the underlying HttpClient.
|
isAcceptGzipEncoding, setAcceptGzipEncoding, supportspublic CommonsHttpMessageSender()
CommonsHttpMessageSender with a default HttpClient that uses a default
MultiThreadedHttpConnectionManager.public CommonsHttpMessageSender(org.apache.commons.httpclient.HttpClient httpClient)
CommonsHttpMessageSender with the given HttpClient instance.httpClient - the HttpClient instance to use for this senderpublic org.apache.commons.httpclient.HttpClient getHttpClient()
HttpClient used by this message sender.public void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
HttpClient used by this message sender.public org.apache.commons.httpclient.Credentials getCredentials()
public void setCredentials(org.apache.commons.httpclient.Credentials credentials)
UsernamePasswordCredentials,
NTCredentialspublic void setConnectionTimeout(int timeout)
timeout - the timeout value in millisecondsHttpConnectionParams.setConnectionTimeout(int)public void setReadTimeout(int timeout)
timeout - the timeout value in millisecondsHttpConnectionParams.setSoTimeout(int)public void setMaxTotalConnections(int maxTotalConnections)
maxTotalConnections - the maximum number of connections allowedHttpConnectionManagerParams.setMaxTotalConnections(int)public void setMaxConnectionsPerHost(Map<String,String> maxConnectionsPerHost) throws org.apache.commons.httpclient.URIException
java.util.Properties class, like as follows:
https://www.example.com=1 http://www.example.com:8080=7 www.springframework.org=10 *=5The host can be specified as hostname, or as URI (with scheme and port). The special host name
* can be
used to specify HostConfiguration.ANY_HOST_CONFIGURATION.maxConnectionsPerHost - a properties object specifying the maximum number of connectionorg.apache.commons.httpclient.URIExceptionHttpConnectionManagerParams.setMaxConnectionsPerHost(org.apache.commons.httpclient.HostConfiguration,
int)public org.apache.commons.httpclient.auth.AuthScope getAuthScope()
credentials property has been set.
By default, the AuthScope.ANY is returned.
public void setAuthScope(org.apache.commons.httpclient.auth.AuthScope authScope)
credentials property has been set.
By default, the AuthScope.ANY is used.
setCredentials(Credentials)public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic WebServiceConnection createConnection(URI uri) throws IOException
WebServiceMessageSenderWebServiceConnection to the specified URI.createConnection in interface WebServiceMessageSenderuri - the URI to open a connection toIOException - in case of I/O errorsCopyright © 2023 VMware, Inc.. All rights reserved.