|
||||||||||
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 org.apache.james.core.MimeMessageWrapper
public class 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/interfaces inherited from class javax.mail.internet.MimeMessage |
---|
javax.mail.internet.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(javax.mail.internet.MimeMessage original)
|
|
MimeMessageWrapper(MimeMessageSource source)
A constructor that instantiates a MimeMessageWrapper based on a MimeMessageSource |
|
MimeMessageWrapper(javax.mail.Session session,
MimeMessageSource source)
A constructor that instantiates a MimeMessageWrapper based on a MimeMessageSource |
Method Summary | |
---|---|
void |
addHeader(java.lang.String name,
java.lang.String value)
|
void |
addHeaderLine(java.lang.String line)
|
protected javax.mail.internet.InternetHeaders |
createInternetHeaders(java.io.InputStream is)
If we already parsed the headers then we simply return the updated ones. |
void |
dispose()
|
java.util.Enumeration |
getAllHeaderLines()
|
java.util.Enumeration |
getAllHeaders()
|
protected java.io.InputStream |
getContentStream()
|
java.lang.String[] |
getHeader(java.lang.String name)
We override all the "headers" access methods to be sure that we loaded the headers |
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter)
|
int |
getLineCount()
Corrects JavaMail 1.1 version which always returns -1. |
java.util.Enumeration |
getMatchingHeaderLines(java.lang.String[] names)
|
java.util.Enumeration |
getMatchingHeaders(java.lang.String[] names)
|
long |
getMessageSize()
Returns size of message, ie headers and content |
java.util.Enumeration |
getNonMatchingHeaderLines(java.lang.String[] names)
|
java.util.Enumeration |
getNonMatchingHeaders(java.lang.String[] names)
|
java.io.InputStream |
getRawInputStream()
|
int |
getSize()
This is the MimeMessage implementation - this should return ONLY the body, not the entire message (should not count headers). |
java.lang.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(java.io.InputStream is)
|
void |
removeHeader(java.lang.String name)
|
void |
setDataHandler(javax.activation.DataHandler arg0)
The message is changed when working with headers and when altering the content. |
void |
setHeader(java.lang.String name,
java.lang.String value)
|
protected void |
updateMessageID()
Overrides standard implementation to ensure JavaMail works appropriately for an email server. |
void |
writeTo(java.io.OutputStream os)
Rewritten for optimization purposes |
void |
writeTo(java.io.OutputStream headerOs,
java.io.OutputStream bodyOs)
Write |
void |
writeTo(java.io.OutputStream headerOs,
java.io.OutputStream bodyOs,
java.lang.String[] ignoreList)
|
void |
writeTo(java.io.OutputStream os,
java.lang.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 |
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(javax.mail.Session session, MimeMessageSource source) throws javax.mail.MessagingException
source
- the MimeMessageSource
javax.mail.MessagingException
public MimeMessageWrapper(MimeMessageSource source) throws javax.mail.MessagingException
source
- the MimeMessageSource
javax.mail.MessagingException
javax.mail.MessagingException
public MimeMessageWrapper(javax.mail.internet.MimeMessage original) throws javax.mail.MessagingException
javax.mail.MessagingException
Method Detail |
---|
public java.lang.String getSourceId()
MimeMessageSource
protected void loadHeaders() throws javax.mail.MessagingException
javax.mail.MessagingException
- if an error is encountered while
loading the headersprotected void loadMessage() throws javax.mail.MessagingException
javax.mail.MessagingException
- if an error is encountered while
loading the messagepublic boolean isModified()
public void writeTo(java.io.OutputStream os) throws java.io.IOException, javax.mail.MessagingException
writeTo
in interface javax.mail.Part
writeTo
in class javax.mail.internet.MimeMessage
java.io.IOException
javax.mail.MessagingException
public void writeTo(java.io.OutputStream os, java.lang.String[] ignoreList) throws java.io.IOException, javax.mail.MessagingException
writeTo
in class javax.mail.internet.MimeMessage
java.io.IOException
javax.mail.MessagingException
public void writeTo(java.io.OutputStream headerOs, java.io.OutputStream bodyOs) throws java.io.IOException, javax.mail.MessagingException
java.io.IOException
javax.mail.MessagingException
public void writeTo(java.io.OutputStream headerOs, java.io.OutputStream bodyOs, java.lang.String[] ignoreList) throws java.io.IOException, javax.mail.MessagingException
java.io.IOException
javax.mail.MessagingException
public int getSize() throws javax.mail.MessagingException
getSize
in interface javax.mail.Part
getSize
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public int getLineCount() throws javax.mail.MessagingException
getLineCount
in interface javax.mail.Part
getLineCount
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public long getMessageSize() throws javax.mail.MessagingException
javax.mail.MessagingException
public java.lang.String[] getHeader(java.lang.String name) throws javax.mail.MessagingException
getHeader
in interface javax.mail.Part
getHeader
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws javax.mail.MessagingException
getHeader
in interface javax.mail.internet.MimePart
getHeader
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getAllHeaders() throws javax.mail.MessagingException
getAllHeaders
in interface javax.mail.Part
getAllHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaders
in interface javax.mail.Part
getMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaders
in interface javax.mail.Part
getNonMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getAllHeaderLines() throws javax.mail.MessagingException
getAllHeaderLines
in interface javax.mail.internet.MimePart
getAllHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaderLines
in interface javax.mail.internet.MimePart
getMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaderLines
in interface javax.mail.internet.MimePart
getNonMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
setHeader
in interface javax.mail.Part
setHeader
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void addHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
addHeader
in interface javax.mail.Part
addHeader
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void removeHeader(java.lang.String name) throws javax.mail.MessagingException
removeHeader
in interface javax.mail.Part
removeHeader
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void addHeaderLine(java.lang.String line) throws javax.mail.MessagingException
addHeaderLine
in interface javax.mail.internet.MimePart
addHeaderLine
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setDataHandler(javax.activation.DataHandler arg0) throws javax.mail.MessagingException
setDataHandler
in interface javax.mail.Part
setDataHandler
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
Part.setDataHandler(javax.activation.DataHandler)
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
Disposable.dispose()
protected void parse(java.io.InputStream is) throws javax.mail.MessagingException
parse
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.parse(java.io.InputStream)
protected javax.mail.internet.InternetHeaders createInternetHeaders(java.io.InputStream is) throws javax.mail.MessagingException
createInternetHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.createInternetHeaders(java.io.InputStream)
protected java.io.InputStream getContentStream() throws javax.mail.MessagingException
getContentStream
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.getContentStream()
public java.io.InputStream getRawInputStream() throws javax.mail.MessagingException
getRawInputStream
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.getRawInputStream()
protected void updateMessageID() throws javax.mail.MessagingException
Overrides standard implementation to ensure JavaMail works appropriately for an email server. Note that MessageID now needs to be explicitly set on different cloned instances.
See JAMES-875
updateMessageID
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.updateMessageID()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |