|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.mail.Message | +--javax.mail.internet.MimeMessage | +--com.ninecode.email.util.EmailMessage
A wrapper for the usual MimeMessage that provides access to the session. Since the RecordFactory is obtained from the ConnectionFactory and not the ManagedConnection (or Connection) which has access to the session, we have to set the session on the message at send time (the interaction has the Connection). Since this was not exposed on MimeMessage, we subclass it and add a zero args constructor and accessors for the session. Users can still treat the messages they receive in the Record as a MimeMessage. This class also provides a utility method and constructor that handle byte arrays of rfc822 encoded data.
Field Summary |
Fields inherited from class javax.mail.internet.MimeMessage |
content, contentStream, dh, flags, headers, modified, saved |
Fields inherited from class javax.mail.Message |
expunged, folder, msgnum, session |
Fields inherited from interface javax.mail.Part |
ATTACHMENT, INLINE |
Constructor Summary | |
EmailMessage()
Creates a new instance of EmailMessage. |
|
EmailMessage(byte[] data)
Convert an array of bytes (in RFC 822 format) to an email message. |
|
EmailMessage(InputStream in)
Create an new instance from a stream. |
Method Summary | |
Session |
getSession()
Get the session associated with this message. |
static EmailMessage |
pickle(MimeMessage message)
Convert a message to internal form (losing the session object within it). |
byte[] |
rfc822()
Output the message as an RFC 822 format array of bytes. |
static byte[] |
rfc822(MimeMessage message)
Output the message as an RFC 822 format array of bytes. |
void |
setSession(Session session)
Set the session associated with this message. |
Methods inherited from class javax.mail.Message |
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EmailMessage()
public EmailMessage(InputStream in) throws MessagingException
in
- The mime input stream to parse.public EmailMessage(byte[] data) throws MessagingException
data
- The data containing the RFC 822 format data.
MessagingException
- If an error occurs converting to RFC 822 format.Method Detail |
public Session getSession()
public void setSession(Session session)
session
- The new session object.public byte[] rfc822() throws IOException, MessagingException
IOException
- If an i/o error occurs.
MessagingException
- If conversion of the message encounters an error.public static byte[] rfc822(MimeMessage message) throws IOException, MessagingException
IOException
- If an i/o error occurs.
MessagingException
- If conversion of the message encounters an error.public static EmailMessage pickle(MimeMessage message) throws IOException, MessagingException
message
- The message to repackage.
IOException
- If an i/o error occurs (unlikely).
MessagingException
- If conversion to or from rfc822 format fails.rfc822()
|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |