Package javax.mail
Class MessageContext
- java.lang.Object
-
- javax.mail.MessageContext
-
public class MessageContext extends java.lang.Object
The context in which a piece of Message content is contained. AMessageContext
object is returned by thegetMessageContext
method of theMessageAware
interface.MessageAware
is typically implemented byDataSources
to allow aDataContentHandler
to pass on information about the context in which a data content object is operating.- Since:
- JavaMail 1.1
- See Also:
MessageAware
,DataSource
,DataContentHandler
-
-
Constructor Summary
Constructors Constructor Description MessageContext(Part part)
Create a MessageContext object describing the context of the given Part.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Message
getMessage()
Return the Message that contains the content.private static Message
getMessage(Part p)
Return the Message containing an arbitrary Part.Part
getPart()
Return the Part that contains the content.Session
getSession()
Return the Session we're operating in.
-
-
-
Field Detail
-
part
private Part part
-
-
Constructor Detail
-
MessageContext
public MessageContext(Part part)
Create a MessageContext object describing the context of the given Part.- Parameters:
part
- the Part
-
-
Method Detail
-
getPart
public Part getPart()
Return the Part that contains the content.- Returns:
- the containing Part, or null if not known
-
getMessage
public Message getMessage()
Return the Message that contains the content. Follows the parent chain up through containing Multipart objects until it comes to a Message object, or null.- Returns:
- the containing Message, or null if not known
-
getMessage
private static Message getMessage(Part p) throws MessagingException
Return the Message containing an arbitrary Part. Follows the parent chain up through containing Multipart objects until it comes to a Message object, or null.- Returns:
- the containing Message, or null if none
- Throws:
MessagingException
- See Also:
BodyPart.getParent()
,Multipart.getParent()
-
getSession
public Session getSession()
Return the Session we're operating in.- Returns:
- the Session, or null if not known
-
-