Home » apache-tomcat-6.0.26-src » org.apache » tomcat » util » [javadoc | source]
org.apache.tomcat.util
public class: MimeHeaders [javadoc | source]
java.lang.Object
   org.apache.tomcat.util.MimeHeaders
This class is used to contain standard internet message headers, used for SMTP (RFC822) and HTTP (RFC2068) messages as well as for MIME (RFC 2045) applications such as transferring typed data and grouping related items in multipart message bodies.

Message headers, as specified in RFC822, include a field name and a field body. Order has no semantic significance, and several fields with the same name may exist. However, most fields do not (and should not) exist more than once in a header.

Many kinds of field body must conform to a specified syntax, including the standard parenthesized comment syntax. This class supports only two simple syntaxes, for dates and integers.

When processing headers, care must be taken to handle the case of multiple same-name fields correctly. The values of such fields are only available as strings. They may be accessed by index (treating the header as an array of fields), or by name (returning an array of string values).

Constructor:
 public MimeHeaders() 
 public MimeHeaders(int len) 
Method from org.apache.tomcat.util.MimeHeaders Summary:
addDateHeader,   addDateHeader,   addHeader,   addHeader,   addIntHeader,   appendHeader,   clear,   containsHeader,   dump,   find,   getAll,   getDateHeader,   getField,   getFieldCount,   getHeader,   getHeader,   getHeaderName,   getHeaders,   getHeadersVector,   getIntHeader,   names,   putDateHeader,   putDateHeader,   putHeader,   putHeader,   putHeader,   putIntHeader,   read,   removeHeader,   size,   toString,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tomcat.util.MimeHeaders Detail:
 public  void addDateHeader(String name) 
 public  void addDateHeader(String name,
    long t) 
 protected MimeHeaderField addHeader(String name) 
 public  void addHeader(String name,
    String s) 
 public  void addIntHeader(String name,
    int i) 
 public  void appendHeader(String name,
    String s) 
    Creates a new header with given name, and add it to the headers.
 public  void clear() 
    Clears all header fields.
 public boolean containsHeader(String name) 
    Returns true if the specified field is contained in the header, otherwise returns false.
 public  void dump(PrintStream out) 
    Dumps current headers to specified PrintStream for debugging.
 protected MimeHeaderField find(String name) 
    Finds and returns a header field with the given name. If no such field exists, null is returned. If more than one such field is in the header, an arbitrary one is returned.
 public int getAll(byte[] buf,
    int buf_offset) 
    Get the current header fields in the byte array buf. The headers fields are placed starting at offset buf_offset.
 public long getDateHeader(String name) throws IllegalArgumentException 
    Returns the date value of a header with the specified name.
 public MimeHeaderField getField(int n) 
    Returns the Nth header field, or null if there is no such header. This may be used to iterate through all header fields.
 public int getFieldCount(String name) 
    Returns the number of fields using a given field name.
 public String getHeader(String name) 
    Returns the string value of one of the headers with the specified name.
 public String getHeader(int n) 
    Returns the body of the nth header field where n >= 0. Returns null if there were fewer than (n + 1) fields. This can be used along with getHeaderName to iterate through all the fields in the header.
 public String getHeaderName(int n) 
    Returns the name of the nth header field where n >= 0. Returns null if there were fewer than (n + 1) fields. This can be used to iterate through all the fields in the header.
 public String[] getHeaders(String name) 
    Returns the string value of all of the headers with the specified name.
 public Vector getHeadersVector(String name) 
    Same as getHeaders, return a Vector - avoid Vector-[]-Vector conversion
 public int getIntHeader(String name) throws NumberFormatException 
    Returns the integer value of a header with the specified name.
 public Enumeration names() 
    Returns an enumeration of strings representing the header field names. Field names may appear multiple times in this enumeration, indicating that multiple fields with that name exist in this header.
 public  void putDateHeader(String name) 
    Creates a new header field whose value is the current date and time.
 public  void putDateHeader(String name,
    long t) 
    Creates a new header field whose value is the specified time. The encoding uses RFC 822 date format, as updated by RFC 1123.
 protected MimeHeaderField putHeader() 
    Adds a partially constructed field to the header. This field has not had its name or value initialized.
 protected MimeHeaderField putHeader(String name) 
    Finds a header field given name. If the header doesn't exist, it will create a new one.
 public  void putHeader(String name,
    String s) 
    Creates a new header field whose value is the specified string.
 public  void putIntHeader(String name,
    int i) 
    Creates a new header field whose value is the specified integer.
 public  void read(ServletInputStream in) throws IOException 
    Reads header fields from the specified servlet input stream until a blank line is encountered.
 public  void removeHeader(String name) 
    Removes a header field with the specified name. Does nothing if such a field could not be found.
 public int size() 
    Returns the current number of header fields.
 public String toString() 
    Returns a lengthly string representation of the current header fields.
 public  void write(ServletOutputStream out) throws IOException 
    Writes out header fields to the specified servlet output stream.