Spring Web Services Framework

org.springframework.ws.transport.mail
Class MailMessageReceiver

java.lang.Object
  extended by org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport
      extended by org.springframework.ws.transport.support.SimpleWebServiceMessageReceiverObjectSupport
          extended by org.springframework.ws.transport.support.AbstractStandaloneMessageReceiver
              extended by org.springframework.ws.transport.support.AbstractAsyncStandaloneMessageReceiver
                  extended by org.springframework.ws.transport.mail.MailMessageReceiver
All Implemented Interfaces:
BeanNameAware, DisposableBean, InitializingBean, Lifecycle

public class MailMessageReceiver
extends AbstractAsyncStandaloneMessageReceiver

Server-side component for receiving email messages using JavaMail. Requires a transport URI, store URI, and monitoringStrategy to be set, in addition to the messageFactory and messageReceiver required by the base class.

The MonitoringStrategy is used to detect new incoming email request. If the monitoringStrategy is not explicitly set, this receiver will use the Pop3PollingMonitoringStrategy for POP3 servers, and the PollingMonitoringStrategy for IMAP servers.

Since:
1.5.0
Author:
Arjen Poutsma

Field Summary
 
Fields inherited from class org.springframework.ws.transport.support.AbstractAsyncStandaloneMessageReceiver
DEFAULT_THREAD_NAME_PREFIX
 
Fields inherited from class org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport
logger
 
Constructor Summary
MailMessageReceiver()
           
 
Method Summary
 void afterPropertiesSet()
          Calls AbstractStandaloneMessageReceiver.activate() when the BeanFactory initializes the receiver instance.
protected  void onActivate()
          Template method invoked when AbstractStandaloneMessageReceiver.activate() is invoked.
protected  void onShutdown()
          Template method invoked when AbstractStandaloneMessageReceiver.shutdown() is invoked.
protected  void onStart()
          Template method invoked when AbstractStandaloneMessageReceiver.start() is invoked.
protected  void onStop()
          Template method invoked when AbstractStandaloneMessageReceiver.stop() is invoked.
 void setFrom(String from)
          Sets the from address to use when sending reponse messages.
 void setJavaMailProperties(Properties javaMailProperties)
          Set JavaMail properties for the Session.
 void setMonitoringStrategy(MonitoringStrategy monitoringStrategy)
          Sets the monitoring strategy to use for retrieving new requests.
 void setSession(Session session)
          Set the JavaMail Session, possibly pulled from JNDI.
 void setStoreUri(String storeUri)
          Sets the JavaMail Store URI to be used for retrieving request messages.
 void setTransportUri(String transportUri)
          Sets the JavaMail Transport URI to be used for sending response messages.
 
Methods inherited from class org.springframework.ws.transport.support.AbstractAsyncStandaloneMessageReceiver
createDefaultTaskExecutor, execute, setBeanName, setTaskExecutor
 
Methods inherited from class org.springframework.ws.transport.support.AbstractStandaloneMessageReceiver
activate, destroy, isActive, isRunning, setAutoStartup, shutdown, start, stop
 
Methods inherited from class org.springframework.ws.transport.support.SimpleWebServiceMessageReceiverObjectSupport
getMessageReceiver, handleConnection, setMessageReceiver
 
Methods inherited from class org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport
getMessageFactory, handleConnection, setMessageFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailMessageReceiver

public MailMessageReceiver()
Method Detail

setFrom

public void setFrom(String from)
             throws AddressException
Sets the from address to use when sending reponse messages.

Throws:
AddressException

setJavaMailProperties

public void setJavaMailProperties(Properties javaMailProperties)
Set JavaMail properties for the Session.

A new Session will be created with those properties. Use either this method or setSession(javax.mail.Session), but not both.

Non-default properties in this instance will override given JavaMail properties.


setSession

public void setSession(Session session)
Set the JavaMail Session, possibly pulled from JNDI.

Default is a new Session without defaults, that is completely configured via this instance's properties.

If using a pre-configured Session, non-default properties in this instance will override the settings in the Session.

See Also:
setJavaMailProperties(java.util.Properties)

setStoreUri

public void setStoreUri(String storeUri)
Sets the JavaMail Store URI to be used for retrieving request messages. Typically takes the form of [imap|pop3]://user:password@host:port/INBOX. Setting this property is required.

For example, imap://john:[email protected]/INBOX

See Also:
Session.getStore(URLName)

setTransportUri

public void setTransportUri(String transportUri)
Sets the JavaMail Transport URI to be used for sending response messages. Typically takes the form of smtp://user:password@host:port. Setting this property is required.

For example, smtp://john:[email protected]

See Also:
Session.getTransport(URLName)

setMonitoringStrategy

public void setMonitoringStrategy(MonitoringStrategy monitoringStrategy)
Sets the monitoring strategy to use for retrieving new requests. Default is the PollingMonitoringStrategy.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Description copied from class: AbstractStandaloneMessageReceiver
Calls AbstractStandaloneMessageReceiver.activate() when the BeanFactory initializes the receiver instance.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class AbstractAsyncStandaloneMessageReceiver
Throws:
Exception

onActivate

protected void onActivate()
                   throws MessagingException
Description copied from class: AbstractStandaloneMessageReceiver
Template method invoked when AbstractStandaloneMessageReceiver.activate() is invoked.

Specified by:
onActivate in class AbstractStandaloneMessageReceiver
Throws:
MessagingException

onStart

protected void onStart()
Description copied from class: AbstractStandaloneMessageReceiver
Template method invoked when AbstractStandaloneMessageReceiver.start() is invoked.

Specified by:
onStart in class AbstractStandaloneMessageReceiver

onStop

protected void onStop()
Description copied from class: AbstractStandaloneMessageReceiver
Template method invoked when AbstractStandaloneMessageReceiver.stop() is invoked.

Specified by:
onStop in class AbstractStandaloneMessageReceiver

onShutdown

protected void onShutdown()
Description copied from class: AbstractStandaloneMessageReceiver
Template method invoked when AbstractStandaloneMessageReceiver.shutdown() is invoked.

Specified by:
onShutdown in class AbstractStandaloneMessageReceiver

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.