|
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.AgoRFC822HeaderField | +--com.sssw.srv.mail.AgoRFC822HeaderFieldString
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 |
public AgoRFC822HeaderFieldString(String fieldname, String fieldbody)
fieldname
- the name of the header.fieldbody
- the body of the header.AgoRFC822HeaderFieldString subject = new AgoRFC822HeaderFieldString("Subject", "Meeting Minutes");
public AgoRFC822HeaderFieldString(String fieldname, String fieldbody, String charset)
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 |
public String getBody()
String body = hString.getBody();
AgoRFC822HeaderFieldString.setBody( String fieldbody )
,
AgoRFC822HeaderFieldString.appendBody( String fieldbody )
public void setBody(String fieldbody)
fieldBody
- specifies the String to set the body to.contentType.setBody("text/plain; charset=us-ascii");
AgoRFC822HeaderFieldString.getBody()
,
AgoRFC822HeaderFieldString.appendBody( String fieldbody )
public void appendBody(String fieldbody)
fieldbody
- specifies the text to add to the end of the body.subject.appendBody(" for tuesday");
AgoRFC822HeaderFieldString.getBody()
,
AgoRFC822HeaderFieldString.setBody( String fieldbody )
,
AgoRFC822HeaderFieldString.appendParameter( String attribute, String value )
public void appendParameter(String attribute, String value)
attribute
- the name of the attribute to add.value
- the value of the parameter to add.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.
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");
AgoRFC822HeaderFieldString.appendBody( String fieldbody )
,
AgoRFC822HeaderFieldString.getBody()
,
AgoRFC822HeaderFieldString.setBody( String fieldbody )
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |