org.mule.transport.email
Class SimpleMailMessageAdapter
java.lang.Object
org.mule.transport.AbstractMessageAdapter
org.mule.transport.email.SimpleMailMessageAdapter
- All Implemented Interfaces:
- Serializable, ThreadSafeAccess, MessageAdapter
- Direct Known Subclasses:
- MailMessageAdapter
public class SimpleMailMessageAdapter
- extends AbstractMessageAdapter
SimpleMailMessageAdapter
is an adapter for mail messages.
Unlike MailMessageAdapter
this preserves the message intact in its original
form.
Header values are stored in two formats. First, as historically used by
MailMessageAdapter
, a single String value is stored for each distinct
header name (if a header is repeated only one value is stored).
Secondly, a list of values for each distinct header is stored in a property name
prefixed by HEADER_LIST_PREFIX
(which produces an invalid header name according to RFC 822 and so (i) avoids
conflict with the first property type and (ii) will cause current applications
that wrongly assume all properties are simple header values to fail fast).
The utility methods
isListHeader(String)
, toHeader(String)
and
toListHeader(String)
identify and convert between property and
header names as required.
- See Also:
- Serialized Form
Methods inherited from class org.mule.transport.AbstractMessageAdapter |
addAttachment, addInboundProperties, addProperties, addProperties, assertAccess, clearProperties, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, getUniqueId, isDisabled, newException, release, removeAttachment, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, setProperty, setReplyTo, setStringProperty, toString |
HEADER_LIST_PREFIX
public static final String HEADER_LIST_PREFIX
- See Also:
- Constant Field Values
SimpleMailMessageAdapter
public SimpleMailMessageAdapter(Object object)
throws MessagingException
- Throws:
MessagingException
SimpleMailMessageAdapter
protected SimpleMailMessageAdapter(SimpleMailMessageAdapter template)
handleMessage
protected void handleMessage(Message message)
throws Exception
- By default, this simply stores the entire message as a single message.
Sub-classes may override with more complex processing.
- Throws:
Exception
setMessage
protected void setMessage(Part message)
getPayload
public Object getPayload()
- Returns:
- the current message
getPayloadAsBytes
public byte[] getPayloadAsBytes()
throws Exception
- Throws:
Exception
getPayloadAsString
public String getPayloadAsString(String encoding)
throws Exception
- Throws:
Exception
isListHeader
public static boolean isListHeader(String name)
- Check whether a property name has the format associated with a list
of header values
- Parameters:
name
- A property name
- Returns:
- true if the name is associated with a list of header values
(more exactly, if it starts with HEADER_LIST_PREFIX, which gives an
invalid header name according to RFC822).
toHeader
public static String toHeader(String name)
- Convert a property name associated with a list of header values to
the relevant header name (ie drop the prefix)
- Parameters:
name
- A property name
- Returns:
- The associated header name (ie with HEADER_LIST_PREFIX removed)
toListHeader
public static String toListHeader(String header)
- Convert a header name to the property name associated with a list of
header values (ie prepend the prefix)
- Parameters:
header
- A header name
- Returns:
- The associated list property name (ie with HEADER_LIST_PREFIX prepended)
newThreadCopy
public ThreadSafeAccess newThreadCopy()
- Description copied from class:
AbstractMessageAdapter
-
- Specified by:
newThreadCopy
in interface ThreadSafeAccess
- Overrides:
newThreadCopy
in class AbstractMessageAdapter
- Returns:
- A new instance of the implementing class, unbound to any thread and mutable.
Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.