|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Message
javax.mail.internet.MimeMessage
org.apache.james.core.MimeMessageWrapper
This object wraps a MimeMessage, only loading the underlying MimeMessage object when needed. Also tracks if changes were made to reduce unnecessary saves.
Nested Class Summary |
Nested classes inherited from class javax.mail.internet.MimeMessage |
MimeMessage.RecipientType |
Field Summary | |
protected boolean |
bodyModified
This is false until we parse the message |
protected boolean |
headersModified
This is false until we parse the message |
protected boolean |
messageParsed
This is false until we parse the message |
protected MimeMessageSource |
source
Can provide an input stream to the data |
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 | |
MimeMessageWrapper(MimeMessage original)
|
|
MimeMessageWrapper(MimeMessageSource source)
A constructor that instantiates a MimeMessageWrapper based on a MimeMessageSource |
|
MimeMessageWrapper(Session session,
MimeMessageSource source)
A constructor that instantiates a MimeMessageWrapper based on a MimeMessageSource |
Method Summary | |
void |
addHeader(String name,
String value)
|
void |
addHeaderLine(String line)
|
protected InternetHeaders |
createInternetHeaders(InputStream is)
If we already parsed the headers then we simply return the updated ones. |
void |
dispose()
|
Enumeration |
getAllHeaderLines()
|
Enumeration |
getAllHeaders()
|
protected InputStream |
getContentStream()
|
String[] |
getHeader(String name)
We override all the "headers" access methods to be sure that we loaded the headers |
String |
getHeader(String name,
String delimiter)
|
int |
getLineCount()
Corrects JavaMail 1.1 version which always returns -1. |
Enumeration |
getMatchingHeaderLines(String[] names)
|
Enumeration |
getMatchingHeaders(String[] names)
|
long |
getMessageSize()
Returns size of message, ie headers and content |
Enumeration |
getNonMatchingHeaderLines(String[] names)
|
Enumeration |
getNonMatchingHeaders(String[] names)
|
InputStream |
getRawInputStream()
|
int |
getSize()
This is the MimeMessage implementation - this should return ONLY the body, not the entire message (should not count headers). |
String |
getSourceId()
Returns the source ID of the MimeMessageSource that is supplying this with data. |
boolean |
isModified()
Get whether the message has been modified. |
protected void |
loadHeaders()
Load the message headers from the internal source. |
protected void |
loadMessage()
Load the complete MimeMessage from the internal source. |
protected void |
parse(InputStream is)
|
void |
removeHeader(String name)
|
void |
setDataHandler(DataHandler arg0)
The message is changed when working with headers and when altering the content. |
void |
setHeader(String name,
String value)
|
void |
writeTo(OutputStream os)
Rewritten for optimization purposes |
void |
writeTo(OutputStream headerOs,
OutputStream bodyOs)
Write |
void |
writeTo(OutputStream headerOs,
OutputStream bodyOs,
String[] ignoreList)
|
void |
writeTo(OutputStream os,
String[] ignoreList)
Rewritten for optimization purposes |
Methods inherited from class javax.mail.internet.MimeMessage |
addFrom, addRecipients, addRecipients, createMimeMessage, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getInputStream, getMessageID, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSubject, isMimeType, isSet, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID |
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 |
Field Detail |
protected MimeMessageSource source
protected boolean messageParsed
protected boolean headersModified
protected boolean bodyModified
Constructor Detail |
public MimeMessageWrapper(Session session, MimeMessageSource source) throws MessagingException
source
- the MimeMessageSource
MessagingException
public MimeMessageWrapper(MimeMessageSource source) throws MessagingException
source
- the MimeMessageSource
MessagingException
MessagingException
public MimeMessageWrapper(MimeMessage original) throws MessagingException
Method Detail |
public String getSourceId()
MimeMessageSource
protected void loadHeaders() throws MessagingException
MessagingException
- if an error is encountered while
loading the headersprotected void loadMessage() throws MessagingException
MessagingException
- if an error is encountered while
loading the messagepublic boolean isModified()
public void writeTo(OutputStream os) throws IOException, MessagingException
writeTo
in interface Part
IOException
MessagingException
public void writeTo(OutputStream os, String[] ignoreList) throws IOException, MessagingException
IOException
MessagingException
public void writeTo(OutputStream headerOs, OutputStream bodyOs) throws IOException, MessagingException
IOException
MessagingException
public void writeTo(OutputStream headerOs, OutputStream bodyOs, String[] ignoreList) throws IOException, MessagingException
IOException
MessagingException
public int getSize() throws MessagingException
getSize
in interface Part
MessagingException
public int getLineCount() throws MessagingException
getLineCount
in interface Part
MessagingException
public long getMessageSize() throws MessagingException
MessagingException
public String[] getHeader(String name) throws MessagingException
getHeader
in interface Part
MessagingException
public String getHeader(String name, String delimiter) throws MessagingException
getHeader
in interface MimePart
MessagingException
public Enumeration getAllHeaders() throws MessagingException
getAllHeaders
in interface Part
MessagingException
public Enumeration getMatchingHeaders(String[] names) throws MessagingException
getMatchingHeaders
in interface Part
MessagingException
public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException
getNonMatchingHeaders
in interface Part
MessagingException
public Enumeration getAllHeaderLines() throws MessagingException
getAllHeaderLines
in interface MimePart
MessagingException
public Enumeration getMatchingHeaderLines(String[] names) throws MessagingException
getMatchingHeaderLines
in interface MimePart
MessagingException
public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException
getNonMatchingHeaderLines
in interface MimePart
MessagingException
public void setHeader(String name, String value) throws MessagingException
setHeader
in interface Part
MessagingException
public void addHeader(String name, String value) throws MessagingException
addHeader
in interface Part
MessagingException
public void removeHeader(String name) throws MessagingException
removeHeader
in interface Part
MessagingException
public void addHeaderLine(String line) throws MessagingException
addHeaderLine
in interface MimePart
MessagingException
public void setDataHandler(DataHandler arg0) throws MessagingException
setDataHandler
in interface Part
MessagingException
Part.setDataHandler(javax.activation.DataHandler)
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
Disposable.dispose()
protected void parse(InputStream is) throws MessagingException
MessagingException
MimeMessage.parse(java.io.InputStream)
protected InternetHeaders createInternetHeaders(InputStream is) throws MessagingException
MessagingException
MimeMessage.createInternetHeaders(java.io.InputStream)
protected InputStream getContentStream() throws MessagingException
MessagingException
MimeMessage.getContentStream()
public InputStream getRawInputStream() throws MessagingException
MessagingException
MimeMessage.getRawInputStream()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |