|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.srv.mail.AgoMIMEPart | +--com.sssw.srv.mail.AgoMIMEPartMultipart
Class that stores MIME parts of type multipart.
When a message consists of multiple parts (e.g., text, a file
attachment, and an image), it is represented as a multipart MIME message.
The AgoMIMEPartMultipart class is a subclass of AgoMIMEPart
.
For example multipart/mixed represents a message with multiple, independent parts.
Another example is multipart/alternative which represents a message
with multiple parts (each of which is considered an alternative
representation of the same data, e.g., an html version and a plain text
version).
Constructor Summary | |
AgoMIMEPartMultipart(String subtype)
A constructor for the AgoMIMEPartMultipart class. |
|
AgoMIMEPartMultipart(String subtype,
AgoRFC822HeaderFieldSet headerfieldset)
A constructor for the AgoMIMEPartMultipart class. |
Method Summary | |
void |
addPart(AgoMIMEPart part)
Adds a MIME part to this multipart part. |
AgoMIMEHeaderField |
contentTypeHeaderField()
Returns an AgoMIMEHeaderField for the content type of this multipart MIME part. |
String |
getBoundary()
Returns the boundary used to separate parts of this multipart MIME part. |
Enumeration |
parts()
Returns an Enumeration of all parts in this part. |
void |
removePart(AgoMIMEPart part)
Removes the specified part from this part. |
void |
setBoundary(String boundary)
Sets a boundary to be used by this part. |
void |
writeBoundary(OutputStream outputstream,
boolean end)
Writes a boundary to the specified outputstream. |
Methods inherited from class com.sssw.srv.mail.AgoMIMEPart |
contentDispositionHeaderField,
contentTransferEncodingHeaderField,
deleteHeaderField,
getHeaderField,
getHeaderFieldSet,
getNameParameterOnContentType,
setHeaderField,
setHeaderField,
setHeaderFieldSet,
setNameParameterOnContentType,
subtype,
type,
write,
writeHeaderFields |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AgoMIMEPartMultipart(String subtype)
subtype
- the subtype of this part (e.g. AgoMIME.SUBTYPE_HTML).
For a list of supported subtypes see supported types and subtypes.The following example adds two parts to this multipart/alternative MIME part. Each represents the same text but one supplies plain ASCII and the other the HTML version. A mail agent should show one or the other of these parts, preferably the "highest quality" one it is capable of. In such a case the MIME specification requires the "lowest quality" part first so that it will be top-most in the message and so a non-MIME mail reader will show it first to user.
In the first example we use the constants defined in AgoMIME to specify the subtype, character set and encoding and in the second example we use the strings that those constants represent.
AgoMIMEPartMultipart part = new AgoMIMEPartMultipart(AgoMIME.SUBTYPE_ALTERNATIVE); AgoCharStoreDyna store1 = new AgoCharStortDyna(); store1.append("Hello World!"); AgoMIMEPartText text1 = new AgoMIMEPartText(AgoMIME.SUBTYPE_PLAIN, null, AgoMIME.CHARSET_US_ASCII, AgoMIME.MECHANISM_7BIT, store1); part.addPart(text1); AgoCharStoreDyna store2 = new AgoCharStortDyna(); store2.append("Hello World!"); AgoMIMEPartText text2 = new AgoMIMEPartText("html", null, "us-ascii", "7bit", store2); part.addPart(text2);
public AgoMIMEPartMultipart(String subtype, AgoRFC822HeaderFieldSet headerfieldset)
subtype
- the subtype of this part (e.g. AgoMIME.SUBTYPE_HTML).
For a list of supported subtypes see supported types and subtypes.headerfieldset
- a set of headers for this part.AgoMIMEPartMultipart mPart = new AgoMIMEPartMultipart(subtypeString, someAgoRFC822HeaderFieldset);
AgoRFC822HeaderFieldSet
Method Detail |
public void writeBoundary(OutputStream outputstream, boolean end) throws IOException
outputstream
- specifies the output stream to write to.end
- specify true if writeBoundary() should include a trailing "--" for the final boundary of a part.The writeBoundary() method outputs an initial CRLF and "--" followed by the boundary set for this multipart part. If end is true, it includes a trailing "--" needed for the last part in a message. In all cases a trailing CRLF is output.
part.writeBoundary(someOutputStream, true);
AgoMIMEPartMultipart.getBoundary()
,
AgoMIMEPartMultipart.setBoundary( String boundary )
public AgoMIMEHeaderField contentTypeHeaderField()
AgoMIMEHeaderField cType = part.contentTypeHeaderField();
AgoMIMEHeaderField
public void addPart(AgoMIMEPart part)
part
- the part to be added.The following example adds two parts to this multipart MIME part. Each is a simple text/plain part created from a hard-coded String. In the first example we use the constants defined in AgoMIME to specify the subtype, character set and encoding and in the second example we use the strings that those constants represent.
AgoCharStoreDyna store1 = new AgoCharStortDyna(); store1.append("Hello "); AgoMIMEPartText text1 = new AgoMIMEPartText(AgoMIME.SUBTYPE_PLAIN, null, AgoMIME.CHARSET_US_ASCII, AgoMIME.MECHANISM_7BIT, store1); part.addPart(text1); AgoCharStoreDyna store2 = new AgoCharStortDyna(); store2.append("World!"); AgoMIMEPartText text2 = new AgoMIMEPartText("plain", null, "iso-8859-1", "7bit", store2); part.addPart(text2);
AgoMIMEPart
public void removePart(AgoMIMEPart part)
part
- the part to be removed.part.removePart(somePart);
AgoMIMEPart
,
AgoMIMEPartMultipart.addPart( AgoMIMEPart part )
,
AgoMIMEPartMultipart.parts()
public String getBoundary()
String boundary = part.getBoundary();
AgoMIMEPartMultipart.setBoundary( String boundary )
,
AgoMIMEPartMultipart.writeBoundary( OutputStream outputstream, boolean end )
public void setBoundary(String boundary)
boundary
- specifies the boundary to set.If this method is not called, a randomly generated boundary will be used when needed. Boundaries must be unique strings not found in the bodies of any of the subparts of the message.
String boundary = "SomeVeryUniqueStringNotInTheMessage"; part.setBoundary(boundary);
AgoBufferingInputStream.clearBoundary()
,
AgoBufferingInputStream.clearMark()
,
AgoBufferingInputStream.setMark()
public Enumeration parts()
Enumeration parts = part.parts();
AgoMIMEPartMultipart.removePart( AgoMIMEPart part)
,
AgoMIMEPartMultipart.addPart( AgoMIMEPart part )
,
AgoMIMEPart
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |