|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.providers.AbstractMessageAdapter
org.mule.providers.email.SimpleMailMessageAdapter
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.
Field Summary | |
static String |
HEADER_LIST_PREFIX
|
Fields inherited from class org.mule.providers.AbstractMessageAdapter |
attachments, DEFAULT_FAILFAST, encoding, exceptionPayload, id, logger, properties, READ, WRITE |
Constructor Summary | |
|
SimpleMailMessageAdapter(Object object)
|
protected |
SimpleMailMessageAdapter(SimpleMailMessageAdapter template)
|
Method Summary | |
Object |
getPayload()
|
byte[] |
getPayloadAsBytes()
Converts the message implementation into a byte array representation |
String |
getPayloadAsString(String encoding)
Converts the message implementation into a String representation |
protected void |
handleMessage(Message message)
By default, this simply stores the entire message as a single message. |
static boolean |
isListHeader(String name)
Check whether a property name has the format associated with a list of header values |
ThreadSafeAccess |
newThreadCopy()
By default we return "this". |
protected void |
setMessage(Part message)
|
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) |
static String |
toListHeader(String header)
Convert a header name to the property name associated with a list of header values (ie prepend the prefix) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String HEADER_LIST_PREFIX
Constructor Detail |
public SimpleMailMessageAdapter(Object object) throws MessagingException
protected SimpleMailMessageAdapter(SimpleMailMessageAdapter template)
Method Detail |
protected void handleMessage(Message message) throws Exception
Exception
protected void setMessage(Part message)
public Object getPayload()
public byte[] getPayloadAsBytes() throws Exception
UMOMessageAdapter
Exception
- Implemetation may throw an endpoint specific exceptionpublic String getPayloadAsString(String encoding) throws Exception
UMOMessageAdapter
encoding
- The encoding to use when transforming the message (if
necessary). The parameter is used when converting from a byte array
Exception
- Implementation may throw an endpoint specific exceptionpublic static boolean isListHeader(String name)
name
- A property name
public static String toHeader(String name)
name
- A property name
public static String toListHeader(String header)
header
- A header name
public ThreadSafeAccess newThreadCopy()
AbstractMessageAdapter
newThreadCopy
in interface ThreadSafeAccess
newThreadCopy
in class AbstractMessageAdapter
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |