SilverStream
Application Server 3.5

com.sssw.srv.mail
Class AgoMIMEPart

java.lang.Object
 |
 +--com.sssw.srv.mail.AgoMIMEPart
Direct Known Subclasses:
AgoMIMEPartByteStream, AgoMIMEPartMessage, AgoMIMEPartMultipart, AgoMIMEPartText

public abstract class AgoMIMEPart
extends Object

Abstract base class of all other MIME parts. It contains the MIME part type and subtype as well as the set of header fields defined in the MIME part.


Constructor Summary
AgoMIMEPart(String type, String subtype)
          A constructor for the AgoMIMEPart class.
AgoMIMEPart(String type, String subtype, AgoRFC822HeaderFieldSet headerfieldset)
          A constructor for the AgoMIMEPart class.
 
Method Summary
 AgoMIMEHeaderField contentDispositionHeaderField()
          Returns the content disposition header or null if there is none.
 AgoMIMEHeaderField contentTransferEncodingHeaderField()
          Returns a header field for the content transfer encoding header or null if there is none.
 AgoMIMEHeaderField contentTypeHeaderField()
          Returns an AgoMIMEHeaderField for the content type.
 void deleteHeaderField(String name)
          Deletes the specified header field.
 AgoRFC822HeaderField getHeaderField(String name)
          Obtains a header field specified by name.
 AgoRFC822HeaderFieldSet getHeaderFieldSet()
          Gets the set of all header fields in this MIME part.
 boolean getNameParameterOnContentType()
          Get the value of the option that defines on which header the name of a file attachment is specified
 void setHeaderField(AgoRFC822HeaderField headerfield)
          Sets a header field.
 void setHeaderField(String name, String body)
          Sets a header field to a String value.
 void setHeaderFieldSet(AgoRFC822HeaderFieldSet headerfieldset)
          Assigns the set of headers for this MIME part.
 void setNameParameterOnContentType(boolean nameparameteroncontenttype)
          Set the option which controls whether the "name" parameter is added to the MIME Content-Type field.
 String subtype()
          Returns the MIME subtype of this part.
 String type()
          Returns the MIME type of this part.
 void write(OutputStream outputstream)
          Writes this part (including headers) to the specified output stream.
 void writeHeaderFields(OutputStream output)
          Writes only the header fields to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoMIMEPart

public AgoMIMEPart(String type,
                   String subtype)
A constructor for the AgoMIMEPart class.
Parameters:
type - the content-type of this part. See supported types and subtypes.
subtype - the content subtype of this part.
Usage:

Note that AgoMIMEPart() is an overloaded method. Use this version when there is no need to specify additional headers. Also note that this is an abstract class; call this constructor only to create a derived subclass.


AgoMIMEPart

public AgoMIMEPart(String type,
                   String subtype,
                   AgoRFC822HeaderFieldSet headerfieldset)
A constructor for the AgoMIMEPart class.
Parameters:
type - the content-type of this part. See supported types and subtypes.
subtype - the content subtype of this part.
headerfieldset - the headers of this MIME part aside from content-type.
Usage:

Note that AgoMIMEPart() is an overloaded constructor. Use this version to specify a set of header fields. Also note that this is an abstract class; call this constructor only to create a derived subclass.

Method Detail

type

public String type()
Returns the MIME type of this part.
Usage:

See supported content types.

Example:
     String type = part.type();
 
See Also:
AgoMIMEPart.subtype()

subtype

public String subtype()
Returns the MIME subtype of this part.
Usage:

See supported types and subtypes.

Example:
     String type = part.subtype();
 
See Also:
AgoMIMEPart.type()

getHeaderField

public AgoRFC822HeaderField getHeaderField(String name)
Obtains a header field specified by name.
Parameters:
name - the header field to obtain.
Example:
     AgoRFC822HeaderField header = part.getHeaderField("Content-Disposition");
 
See Also:
AgoMIMEPart.setHeaderField( AgoRFC822HeaderField headerfield )

setHeaderField

public void setHeaderField(AgoRFC822HeaderField headerfield)
Sets a header field.
Parameters:
headerfield - the header field to set.
Usage:

This method overwrites the old value of the header field. Note that this method is an overloaded method. This version is used when working with an AgoRFC822HeaderField object.

Example:
     AgoRFC822HeaderField header;
     part.setHeaderField(header);
 
See Also:
AgoMIMEPart.getHeaderField( String name )

setHeaderField

public void setHeaderField(String name,
                           String body)
Sets a header field to a String value.
Parameters:
name - the name of the header field to set.
body - the value for the named header field.
Usage:

This method overwrites the old value of the header field. Note that this is an overloaded method. This version is used when the name and value are in String format.

Example:
     part.setHeaderField("Content-Type", "text/html");
 
See Also:
AgoMIMEPart.getHeaderField( String name )

deleteHeaderField

public void deleteHeaderField(String name)
Deletes the specified header field.
Parameters:
name - the name of the header field to delete.
Example:
     part.deleteHeaderField("Content-Disposition");
 
See Also:
AgoMIMEPart.getHeaderField( String name ), AgoMIMEPart.setHeaderField( String name, String body )

getHeaderFieldSet

public AgoRFC822HeaderFieldSet getHeaderFieldSet()
Gets the set of all header fields in this MIME part.
Example:
     AgoRFC822HeaderFieldSet headers = part.getHeaderFieldSet();
 
See Also:
AgoMIMEPart.setHeaderFieldSet( AgoRFC822HeaderFieldSet headerfieldset )

setHeaderFieldSet

public void setHeaderFieldSet(AgoRFC822HeaderFieldSet headerfieldset)
Assigns the set of headers for this MIME part.
Parameters:
headerfieldset - the headerfieldset.
Example:
     AgoRFC822HeaderFieldSet headers;
     part.setHeaderFieldSet(headers);
 
See Also:
AgoRFC822HeaderFieldSet

write

public void write(OutputStream outputstream)
           throws IOException
Writes this part (including headers) to the specified output stream.
Parameters:
outputStream - the output stream to write to.
Example:
     part.write(outputStream);
 

writeHeaderFields

public void writeHeaderFields(OutputStream output)
                       throws IOException
Writes only the header fields to the specified output stream.
Parameters:
outputstream - the output stream.
Example:
     part.writeHeaderFields(outputStream);
 
See Also:
AgoMIMEPart.setHeaderField( String name, String body ), AgoMIMEPart.getHeaderField( String name )

contentTypeHeaderField

public AgoMIMEHeaderField contentTypeHeaderField()
Returns an AgoMIMEHeaderField for the content type.
Example:
     AgoMIMEHeaderField cType = mPart.contentTypeHeaderField();
 
See Also:
AgoMIMEHeaderField

contentTransferEncodingHeaderField

public AgoMIMEHeaderField contentTransferEncodingHeaderField()
Returns a header field for the content transfer encoding header or null if there is none.
Example:
     AgoMIMEHeaderField cTra = part.contentTransferEncodingHeaderField();
 
See Also:
AgoMIMEHeaderField, AgoMIMEPartByteStream.getEncodingIdentifier(), AgoMIMEPartByteStream.setEncodingIdentifier( AgoEncodingIdentifier encodingidentifier )

contentDispositionHeaderField

public AgoMIMEHeaderField contentDispositionHeaderField()
Returns the content disposition header or null if there is none.
Example:
     AgoMIMEHeaderField cDis = part.contentDispositionHeaderField();
 
See Also:
AgoMIMEHeaderField, AgoMIMEPartByteStream.getContentDisposition(), AgoMIMEPartByteStream.setContentDisposition( String contentdisposition )

getNameParameterOnContentType

public boolean getNameParameterOnContentType()
Get the value of the option that defines on which header the name of a file attachment is specified
Usage:

Normally, the name of a file attachment, image, etc. should be specified in the "filename" parameter of the Content-Disposition header field as per RFC1806. However, some older mail UA's want to attach it to the Content-Type header, so we allow it here simply as an option in order to increase compatibility with these programs.

See Also:
AgoMIMEPart.setNameParameterOnContentType( boolean nameparameteroncontenttype )

setNameParameterOnContentType

public void setNameParameterOnContentType(boolean nameparameteroncontenttype)
Set the option which controls whether the "name" parameter is added to the MIME Content-Type field.
Parameters:
nameparameteroncontenttype - when true the name parameter is added.
Usage:

Normally, the name of a file attachment, image, etc. should be specified in the "filename" parameter of the Content-Disposition header field as per RFC1806. However, some older mail UA's want to attach it to the Content-Type header, so we allow it here simply as an option in order to increase compatibility with these programs.

See Also:
AgoMIMEPart.getNameParameterOnContentType()

SilverStream
Application Server 3.5