org.jasig.portlet.calendar.adapter.exchange
Class ExchangeHttpWebServiceMessageSender

java.lang.Object
  extended by org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
      extended by org.jasig.portlet.calendar.adapter.exchange.ExchangeHttpWebServiceMessageSender
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.ws.transport.WebServiceMessageSender

public class ExchangeHttpWebServiceMessageSender
extends org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

ExchangeHttpWebServiceMessageSender is a subclass of AbstractHttpWebServiceMessageSender designed to connect to an Exchange web service protected by user-specific basic authentication. The default Spring implementations of Http-based message senders only allow for performing basic authentication with shared credentials. This implementation is dependent on the user credentials object existing in a ThreadLocal managed by a Spring RequestContextHolder.

Version:
$Revision$
Author:
Jen Bourey, jbourey@unicon.net

Field Summary
protected static String EXCHANGE_CLIENT_ATTRIBUTE
           
protected static String EXCHANGE_CREDENTIALS_ATTRIBUTE
           
 
Fields inherited from class org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender
logger
 
Constructor Summary
ExchangeHttpWebServiceMessageSender()
           
 
Method Summary
 void afterPropertiesSet()
           
 org.springframework.ws.transport.WebServiceConnection createConnection(URI uri)
           
 void destroy()
           
protected  org.apache.commons.httpclient.HttpClient getClient()
          Return an HttpClient instance configured with authentication credentials for the current user.
protected  org.apache.commons.httpclient.Credentials getCredentials()
          Get the credentials to use with the HttpClient.
 void setConnectionTimeout(int connectionTimeout)
          Set the connection timeout.
 void setMaxConnections(int maxConnections)
          Set the max connections for the overall client.
 void setReadTimeout(int readTimeout)
          Set the read timeout.
 
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
 

Field Detail

EXCHANGE_CREDENTIALS_ATTRIBUTE

protected static final String EXCHANGE_CREDENTIALS_ATTRIBUTE
See Also:
Constant Field Values

EXCHANGE_CLIENT_ATTRIBUTE

protected static final String EXCHANGE_CLIENT_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

ExchangeHttpWebServiceMessageSender

public ExchangeHttpWebServiceMessageSender()
Method Detail

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)
Set the connection timeout.

Parameters:
connectionTimeout -

setReadTimeout

public void setReadTimeout(int readTimeout)
Set the read timeout.

Parameters:
readTimeout -

setMaxConnections

public void setMaxConnections(int maxConnections)
Set the max connections for the overall client. The max connections per host will also be set to this same value, since the expected usage pattern involves an http connection manager making connections to only one host.

Parameters:
maxConnections -

createConnection

public org.springframework.ws.transport.WebServiceConnection createConnection(URI uri)
                                                                       throws IOException
Specified by:
createConnection in interface org.springframework.ws.transport.WebServiceMessageSender
Throws:
IOException

getClient

protected org.apache.commons.httpclient.HttpClient getClient()
Return an HttpClient instance configured with authentication credentials for the current user. This implementation caches HttpClient instances in a RequestContextHolder for later use by the same user.

Returns:
HttpClient authenticated client

getCredentials

protected org.apache.commons.httpclient.Credentials getCredentials()
Get the credentials to use with the HttpClient. This implementation pulls an existing crednetials object from a Spring RequestContextHolder.

Returns:

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception


Copyright © 2012 Jasig. All Rights Reserved.