Spring Web Services Framework

org.springframework.ws.transport.http
Class CommonsHttpMessageSender

java.lang.Object
  extended by org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
      extended by org.springframework.ws.transport.http.CommonsHttpMessageSender
All Implemented Interfaces:
DisposableBean, InitializingBean, WebServiceMessageSender

public class CommonsHttpMessageSender
extends AbstractHttpWebServiceMessageSender
implements InitializingBean, 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).

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
HttpUrlConnectionMessageSender, HttpClient, setCredentials(Credentials)

Field Summary
 
Fields inherited from class org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
ENCODING_GZIP, HTTP_HEADER_ACCEPT_ENCODING, HTTP_SCHEME, HTTPS_SCHEME
 
Constructor Summary
CommonsHttpMessageSender()
          Create a new instance of the CommonsHttpMessageSender with a default HttpClient that uses a default MultiThreadedHttpConnectionManager.
CommonsHttpMessageSender(HttpClient httpClient)
          Create a new instance of the CommonsHttpMessageSender with the given HttpClient instance.
 
Method Summary
 void afterPropertiesSet()
           
 WebServiceConnection createConnection(String uri)
          Create a new WebServiceConnection to the specified URI.
 void destroy()
           
 AuthScope getAuthScope()
          Returns the authentication scope to be used.
 Credentials getCredentials()
          Returns the credentials to be used.
 HttpClient getHttpClient()
          Returns the HttpClient used by this message sender.
 void setAuthScope(AuthScope authScope)
          Sets the authentication scope to be used.
 void setCredentials(Credentials credentials)
          Sets the credentials to be used.
 void setHttpClient(HttpClient httpClient)
          Set the HttpClient used by this message sender.
 
Methods inherited from class org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
isAcceptGzipEncoding, setAcceptGzipEncoding, supports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsHttpMessageSender

public CommonsHttpMessageSender()
Create a new instance of the CommonsHttpMessageSender with a default HttpClient that uses a default MultiThreadedHttpConnectionManager.


CommonsHttpMessageSender

public CommonsHttpMessageSender(HttpClient httpClient)
Create a new instance of the CommonsHttpMessageSender with the given HttpClient instance.

Parameters:
httpClient - the HttpClient instance to use for this sender
Method Detail

getHttpClient

public HttpClient getHttpClient()
Returns the HttpClient used by this message sender.


setHttpClient

public void setHttpClient(HttpClient httpClient)
Set the HttpClient used by this message sender.


getCredentials

public Credentials getCredentials()
Returns the credentials to be used.


setCredentials

public void setCredentials(Credentials credentials)
Sets the credentials to be used. If not set, no authentication is done.

See Also:
UsernamePasswordCredentials, NTCredentials

getAuthScope

public AuthScope getAuthScope()
Returns the authentication scope to be used. Only used when the credentials property has been set.

By default, the AuthScope.ANY is returned.


setAuthScope

public void setAuthScope(AuthScope authScope)
Sets the authentication scope to be used. Only used when the credentials property has been set.

By default, the AuthScope.ANY is used.

See Also:
setCredentials(Credentials)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

createConnection

public WebServiceConnection createConnection(String uri)
                                      throws IOException
Description copied from interface: WebServiceMessageSender
Create a new WebServiceConnection to the specified URI.

Specified by:
createConnection in interface WebServiceMessageSender
Parameters:
uri - the URI to open a connection to
Returns:
the new connection
Throws:
IOException - in case of I/O errors

Spring Web Services Framework

Copyright � 2005-2008 The Spring Web Services Framework. All Rights Reserved.