org.apache.http
Class Header

java.lang.Object
  extended by org.apache.http.Header
Direct Known Subclasses:
Header.BufferedHeader

public class Header
extends java.lang.Object

Represents an HTTP header field.

The HTTP header fields follow the same generic format as that given in Section 3.1 of RFC 822. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. The field value MAY be preceded by any amount of LWS, though a single SP is preferred.

     message-header = field-name ":" [ field-value ]
     field-name     = token
     field-value    = *( field-content | LWS )
     field-content  = <the OCTETs making up the field-value
                      and consisting of either *TEXT or combinations
                      of token, separators, and quoted-string>

Version:
$Revision: 391251 $ $Date: 2006-04-04 10:52:13 +0200 (Tue, 04 Apr 2006) $
Author:
Remy Maucherat, Mike Bowler, Oleg Kalnichevski

Nested Class Summary
(package private) static class Header.BufferedHeader
          This class represents a raw HTTP header whose content is parsed 'on demand' only when the header value needs to be consumed
 
Constructor Summary
Header(java.lang.String name, java.lang.String value)
          Constructor with name and value
 
Method Summary
static void format(CharArrayBuffer buffer, Header header)
          Formats a Header into a header line.
static java.lang.String format(Header header)
           
 HeaderElement[] getElements()
          Returns an array of HeaderElements constructed from my value.
 java.lang.String getName()
          Returns the header name.
 java.lang.String getValue()
          Returns the header value.
static Header[] parseAll(HttpDataReceiver datareceiver)
           
 java.lang.String toString()
          Returns a String representation of the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Header

public Header(java.lang.String name,
              java.lang.String value)
Constructor with name and value

Parameters:
name - the header name
value - the header value
Method Detail

getName

public java.lang.String getName()
Returns the header name.

Returns:
String name The name

getValue

public java.lang.String getValue()
Returns the header value.

Returns:
String value The current value.

toString

public java.lang.String toString()
Returns a String representation of the header.

Overrides:
toString in class java.lang.Object
Returns:
a string

getElements

public HeaderElement[] getElements()
Returns an array of HeaderElements constructed from my value.

Returns:
an array of header elements
Since:
3.0
See Also:
HeaderElement.parseAll(org.apache.http.io.CharArrayBuffer, int, int)

format

public static void format(CharArrayBuffer buffer,
                          Header header)
Formats a Header into a header line. The header is directly appended to buffer; no newline characters are inserted (folding).

Parameters:
buffer - the buffer to append to
header - the header to format

format

public static java.lang.String format(Header header)
See Also:
format(CharArrayBuffer, Header)

parseAll

public static Header[] parseAll(HttpDataReceiver datareceiver)
                         throws HttpException,
                                java.io.IOException
Throws:
HttpException
java.io.IOException


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.