SilverStream
Application Server 3.5

com.sssw.srv.mail
Class AgoRFC822HeaderFieldString

java.lang.Object
 |
 +--com.sssw.srv.mail.AgoRFC822HeaderField
       |
       +--com.sssw.srv.mail.AgoRFC822HeaderFieldString

public class AgoRFC822HeaderFieldString
extends AgoRFC822HeaderField

Class that stores a single, String-based header field. It is a subclass of AgoRFC822HeaderField.


Constructor Summary
AgoRFC822HeaderFieldString(String fieldname, String fieldbody)
          A constructor for the AgoRFC822HeaderFieldString class.
AgoRFC822HeaderFieldString(String fieldname, String fieldbody, String charset)
          A constructor for the AgoRFC822HeaderFieldString class.
 
Method Summary
 void appendBody(String fieldbody)
          Appends the specified String to the end of the field body.
 void appendParameter(String attribute, String value)
          Appends a Parameter, in the form of an attribute/value pair, to the end of the body.
 String getBody()
          Returns the field body.
 void setBody(String fieldbody)
          Sets the field body to the specified String, replacing any existing body.
 
Methods inherited from class com.sssw.srv.mail.AgoRFC822HeaderField
getName, setName, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoRFC822HeaderFieldString

public AgoRFC822HeaderFieldString(String fieldname,
                                  String fieldbody)
A constructor for the AgoRFC822HeaderFieldString class.
Parameters:
fieldname - the name of the header.
fieldbody - the body of the header.
Example:
     AgoRFC822HeaderFieldString subject = new AgoRFC822HeaderFieldString("Subject",
                                                                         "Meeting Minutes");
 

AgoRFC822HeaderFieldString

public AgoRFC822HeaderFieldString(String fieldname,
                                  String fieldbody,
                                  String charset)
A constructor for the AgoRFC822HeaderFieldString class.
Parameters:
fieldname - the name of the header.
fieldbody - the body of the header.
charset - specifies the character set for the name of the header.
Method Detail

getBody

public String getBody()
Returns the field body.
Example:
     String body = hString.getBody();
 
See Also:
AgoRFC822HeaderFieldString.setBody( String fieldbody ), AgoRFC822HeaderFieldString.appendBody( String fieldbody )

setBody

public void setBody(String fieldbody)
Sets the field body to the specified String, replacing any existing body.
Parameters:
fieldBody - specifies the String to set the body to.
Example:
     contentType.setBody("text/plain; charset=us-ascii");
 
See Also:
AgoRFC822HeaderFieldString.getBody(), AgoRFC822HeaderFieldString.appendBody( String fieldbody )

appendBody

public void appendBody(String fieldbody)
Appends the specified String to the end of the field body.
Parameters:
fieldbody - specifies the text to add to the end of the body.
Example:
     subject.appendBody(" for tuesday");
 
See Also:
AgoRFC822HeaderFieldString.getBody(), AgoRFC822HeaderFieldString.setBody( String fieldbody ), AgoRFC822HeaderFieldString.appendParameter( String attribute, String value )

appendParameter

public void appendParameter(String attribute,
                            String value)
Appends a Parameter, in the form of an attribute/value pair, to the end of the body.
Parameters:
attribute - the name of the attribute to add.
value - the value of the parameter to add.
Usage:

The appendParameter() method blindly adds the parameter at the end of the body. If appendBody(String) is called subsequently, the new String is added after the parameter, which may not be the desired result.

Example:

Some header fields can have parameters at the end of them. for example, the Content-Type header field typically has a value of "text/plain" and a parameter which is "charset-us-ascii", (this is what Content-Type should be set to for an ASCII MIME part). This header is written as:

      Content-Type: text/plain; charset=us-ascii
 

Notice that the parameter is listed at the end, after the value. Either of these examples would construct the header:

     AgoRFC822HeaderFieldString header = null;
     header = AgoRFC822HeaderFieldString("Content-Type", "text/plain");
     header.addParameter("charset", "us-ascii");
 
     AgoRFC822HeaderFieldString header = null;
     header = AgoRFC822HeaderFieldString("Content-Type", "text/");
     header.appendBody("plain");
     header.addParameter("charset", "us-ascii");
 

The following code will generate the wrong header:

     // Do _not_ do this. Produces:
     // Content-Type: text/; charset=us-asciiplain
     AgoRFC822HeaderFieldString header = null;
     header = AgoRFC822HeaderFieldString("Content-Type", "text/");
     header.addParameter("charset", "us-ascii");
     header.appendBody("plain");
 
See Also:
AgoRFC822HeaderFieldString.appendBody( String fieldbody ), AgoRFC822HeaderFieldString.getBody(), AgoRFC822HeaderFieldString.setBody( String fieldbody )

SilverStream
Application Server 3.5