Package org.apache.http.message
Class BasicHeader
java.lang.Object
org.apache.http.message.BasicHeader
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
- Version:
- $Revision: 652956 $ $Date: 2008-05-02 17:13:05 -0700 (Fri, 02 May 2008) $
- Author:
- Remy Maucherat, Mike Bowler, Oleg Kalnichevski
-
Constructor Summary
Constructors Constructor Description BasicHeader(String name, String value)Constructor with name and value -
Method Summary
Modifier and Type Method Description Objectclone()Creates and returns a copy of thisObject.HeaderElement[]getElements()Returns an array ofHeaderElements constructed from my value.StringgetName()Returns the header name.StringgetValue()Returns the header value.StringtoString()Returns aStringrepresentation of the header.
-
Constructor Details
-
BasicHeader
Constructor with name and value- Parameters:
name- the header namevalue- the header value
-
-
Method Details
-
getName
Returns the header name. -
getValue
Returns the header value. -
toString
Returns aStringrepresentation of the header. -
getElements
Returns an array ofHeaderElements constructed from my value.- Specified by:
getElementsin interfaceHeader- Returns:
- an array of header elements
- Throws:
ParseException- in case of a parse error- See Also:
BasicHeaderValueParser.parseElements(String, HeaderValueParser)
-
clone
Description copied from class:ObjectCreates and returns a copy of thisObject. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should callsuper.clone()to create the new instance and then create deep copies of the nested, mutable objects.- Overrides:
clonein classObject- Returns:
- a copy of this object.
- Throws:
CloneNotSupportedException- if this object's class does not implement theCloneableinterface.
-