com.mortbay.HTTP
Class HttpHeader

java.lang.Object
  |
  +--com.mortbay.HTTP.HttpHeader
Direct Known Subclasses:
HttpRequest, HttpResponse

public class HttpHeader
extends java.lang.Object


Field Summary
static byte[] __COLON
           
static byte[] __CRLF
           
static java.text.SimpleDateFormat[] __dateReceive
           
static DateCache __dateSend
           
static java.util.Hashtable __singleValuedMap
           
static java.lang.String Authorization
           
static java.lang.String Chunked
           
static java.lang.String Close
           
static java.lang.String COLON
           
static java.lang.String Connection
           
static java.lang.String ContentLength
           
static java.lang.String ContentType
           
static java.lang.String Cookie
           
static java.lang.String CRLF
           
static java.lang.String Date
           
static java.lang.String Expires
           
static java.lang.String Host
           
static java.lang.String HTTP_1_0
           
static java.lang.String HTTP_1_1
           
static java.lang.String IfModifiedSince
           
static java.lang.String IfUnmodifiedSince
           
static java.lang.String LastModified
           
static java.lang.String Referer
           
static java.lang.String SetCookie
           
static java.lang.String[] SingleValued
           
static java.lang.String TransferEncoding
           
static java.lang.String UserAgent
           
static java.lang.String WwwAuthenticate
           
static java.lang.String WwwFormUrlEncode
           
 
Constructor Summary
HttpHeader()
           
 
Method Summary
 void destroy()
          Destroy the header.
 void dump()
           
 long getDateHeader(java.lang.String name)
          Get a header as a date value.
 java.lang.String getHeader(java.lang.String key)
          Returns the value of a header field, or null if not found.
 java.util.Enumeration getHeaderNames()
          Get enumeration of header names.
 int getIntHeader(java.lang.String name)
          Get a header as an integer value.
 void read(HttpInputStream in)
          Read HttpHeaders from inputStream.
 void setDateHeader(java.lang.String name, long date)
          Sets the value of a date header field.
 void setHeader(java.lang.String key, java.lang.String value)
          Set a header field.
 void setIntHeader(java.lang.String name, int value)
          Sets the value of an integer header field.
 java.lang.String toString()
           
protected  void write(java.io.OutputStream out)
           
protected  void write(java.io.Writer writer)
           
protected  void write(java.io.Writer writer, java.lang.String extra)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ContentType

public static final java.lang.String ContentType

TransferEncoding

public static final java.lang.String TransferEncoding

Chunked

public static final java.lang.String Chunked

ContentLength

public static final java.lang.String ContentLength

WwwFormUrlEncode

public static final java.lang.String WwwFormUrlEncode

WwwAuthenticate

public static final java.lang.String WwwAuthenticate

Authorization

public static final java.lang.String Authorization

Host

public static final java.lang.String Host

Date

public static final java.lang.String Date

Cookie

public static final java.lang.String Cookie

SetCookie

public static final java.lang.String SetCookie

Connection

public static final java.lang.String Connection

Close

public static final java.lang.String Close

Referer

public static final java.lang.String Referer

Expires

public static final java.lang.String Expires

UserAgent

public static final java.lang.String UserAgent

IfModifiedSince

public static final java.lang.String IfModifiedSince

IfUnmodifiedSince

public static final java.lang.String IfUnmodifiedSince

LastModified

public static final java.lang.String LastModified

SingleValued

public static final java.lang.String[] SingleValued

__singleValuedMap

public static final java.util.Hashtable __singleValuedMap

CRLF

public static final java.lang.String CRLF

__CRLF

public static final byte[] __CRLF

__COLON

public static final byte[] __COLON

COLON

public static final java.lang.String COLON

HTTP_1_0

public static final java.lang.String HTTP_1_0

HTTP_1_1

public static final java.lang.String HTTP_1_1

__dateSend

public static final DateCache __dateSend

__dateReceive

public static java.text.SimpleDateFormat[] __dateReceive
Constructor Detail

HttpHeader

public HttpHeader()
Method Detail

getHeaderNames

public java.util.Enumeration getHeaderNames()
Get enumeration of header names. Returns an enumeration of strings representing the header names for this request.

getHeader

public java.lang.String getHeader(java.lang.String key)
Returns the value of a header field, or null if not found. The case of the header field name is ignored.
Parameters:
key - the case-insensitive header field name

setHeader

public void setHeader(java.lang.String key,
                      java.lang.String value)
Set a header field.

read

public void read(HttpInputStream in)
          throws java.io.IOException
Read HttpHeaders from inputStream.

dump

public void dump()

write

protected void write(java.io.Writer writer,
                     java.lang.String extra)
              throws java.io.IOException

write

protected void write(java.io.OutputStream out)
              throws java.io.IOException

write

protected void write(java.io.Writer writer)
              throws java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getIntHeader

public int getIntHeader(java.lang.String name)
Get a header as an integer value. Returns the value of an integer header field, or -1 if not found. The case of the header field name is ignored.
Parameters:
name - the case-insensitive header field name

getDateHeader

public long getDateHeader(java.lang.String name)
Get a header as a date value. Returns the value of a date header field, or -1 if not found. The case of the header field name is ignored.
Parameters:
name - the case-insensitive header field name

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Sets the value of an integer header field.
Parameters:
name - the header field name
value - the header field integer value

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
Sets the value of a date header field.
Parameters:
name - the header field name
value - the header field date value

destroy

public void destroy()
Destroy the header. Help the garbage collector by null everything that we can.