Build 1.0_r1(from source)

org.apache.http.message
Class BasicHeader

java.lang.Object
  extended by org.apache.http.message.BasicHeader
All Implemented Interfaces:
Cloneable, Header

public class BasicHeader
extends Object
implements Header, Cloneable

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>

Since:
4.0

Constructor Summary
BasicHeader(String name, String value)
          Constructor with name and value
 
Method Summary
 Object clone()
          Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
 HeaderElement[] getElements()
          Returns an array of HeaderElements constructed from my value.
 String getName()
          Returns the header name.
 String getValue()
          Returns the header value.
 String toString()
          Returns a String representation of the header.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicHeader

public BasicHeader(String name,
                   String value)
Constructor with name and value

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

getName

public String getName()
Returns the header name.

Specified by:
getName in interface Header
Returns:
String name The name

getValue

public String getValue()
Returns the header value.

Specified by:
getValue in interface Header
Returns:
String value The current value.

toString

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

Overrides:
toString in class Object
Returns:
a string

getElements

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

Specified by:
getElements in interface Header
Returns:
an array of header elements
Throws:
ParseException - in case of a parse error
See Also:
BasicHeaderValueParser.parseElements(String, HeaderValueParser)

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: Object
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.

Classes which wish to support cloning must specify that they implement the Cloneable interface, since the implementation checks for this.

Overrides:
clone in class Object
Returns:
Object a shallow copy of this object.
Throws:
CloneNotSupportedException - if the receiver's class does not implement the interface Cloneable.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature