com.ibm.wbi.util
Class HeaderField

java.lang.Object
  |
  +--com.ibm.wbi.util.HeaderField
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
HttpSetCookie

public class HeaderField
extends java.lang.Object
implements java.lang.Cloneable

HeaderField provides methods for dealing with a single line of a MIME header. A header to consist of two parts: the value and the parameters. Consider a header field like this:

 Header-Field: foobarbaz; a=x; b=y; secure; c=z
 
Assuming the header is part of a MimeHeaderAscii called h, you can get a HeaderField object like this: h.parseHeaderField("Header-Field");. The "value" part is "foobarbaz", and parameters are "a", "b", "secure", and "c". "secure" has no value (the empty string), and "a", "b", and "c" have the obvious values ("x", "y", and "z", respectively).

See Also:
MimeHeaderAscii

Field Summary
protected  CIHashtable params
           
protected  java.lang.String val
           
 
Constructor Summary
HeaderField()
          Creates a new HeaderField instance.
HeaderField(java.lang.String full)
          Creates a new HeaderField instance.
 
Method Summary
 java.lang.Object clone()
          Make a clone or deep-copy of this header field
 java.lang.String getParam(java.lang.String p)
          Get the named paramter of the header field
 java.lang.String getParameters()
          Get a string represenation of the parameters of this header field.
 java.lang.String getValue()
          Get the value of the header field
static void main(java.lang.String[] argv)
          Testing code
 java.lang.String removeParam(java.lang.String p)
          Remove the named parameter
 void removeParameters()
          Delete all the paramaters.
 void setParam(java.lang.String p, java.lang.String v)
          Set the named parameter to the specified value
 void setValue(java.lang.String val)
          Set the value of the header field
 java.lang.String toString()
          Give the string representation of the header field
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

val

protected java.lang.String val

params

protected CIHashtable params
Constructor Detail

HeaderField

public HeaderField()
Creates a new HeaderField instance.

HeaderField

public HeaderField(java.lang.String full)
Creates a new HeaderField instance.
Parameters:
full - The unparsed value of the header field
Method Detail

clone

public java.lang.Object clone()
Make a clone or deep-copy of this header field
Overrides:
clone in class java.lang.Object
Returns:
an Object value

toString

public java.lang.String toString()
Give the string representation of the header field
Overrides:
toString in class java.lang.Object
Returns:
a String value

getValue

public java.lang.String getValue()
Get the value of the header field
Returns:
a String value

setValue

public void setValue(java.lang.String val)
Set the value of the header field
Parameters:
val - a String value

getParam

public java.lang.String getParam(java.lang.String p)
Get the named paramter of the header field
Parameters:
p - The name of the paramater
Returns:
The value of the parameter or null

setParam

public void setParam(java.lang.String p,
                     java.lang.String v)
Set the named parameter to the specified value
Parameters:
p - The name of the paramter to set
v - The value to set the parameter to

removeParam

public java.lang.String removeParam(java.lang.String p)
Remove the named parameter
Parameters:
p - The name of the parameter to remove
Returns:
The old value or null

getParameters

public java.lang.String getParameters()
Get a string represenation of the parameters of this header field.
Returns:
a String value

removeParameters

public void removeParameters()
Delete all the paramaters.

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Testing code
Parameters:
argv[] - a String value
Throws:
java.lang.Exception - if an error occurs