FileDocCategorySizeDatePackage
BasicHeader.javaAPI DocAndroid 1.5 API4582Wed May 06 22:41:10 BST 2009org.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>
author
Remy Maucherat
author
Mike Bowler
author
Oleg Kalnichevski
version
$Revision: 652956 $ $Date: 2008-05-02 17:13:05 -0700 (Fri, 02 May 2008) $
since
4.0

Fields Summary
private final String
name
Header name.
private final String
value
Header value.
Constructors Summary
public BasicHeader(String name, String value)
Constructor with name and value

param
name the header name
param
value the header value

        super();
        if (name == null) {
            throw new IllegalArgumentException("Name may not be null");
        }
        this.name = name;
        this.value = value;
    
Methods Summary
public java.lang.Objectclone()

        return super.clone();
    
public org.apache.http.HeaderElement[]getElements()
Returns an array of {@link HeaderElement}s constructed from my value.

see
BasicHeaderValueParser#parseElements(String, HeaderValueParser)
return
an array of header elements
throws
ParseException in case of a parse error

        if (this.value != null) {
            // result intentionally not cached, it's probably not used again
            return BasicHeaderValueParser.parseElements(this.value, null);
        } else {
            return new HeaderElement[] {}; 
        }
    
public java.lang.StringgetName()
Returns the header name.

return
String name The name

        return this.name;
    
public java.lang.StringgetValue()
Returns the header value.

return
String value The current value.

        return this.value;
    
public java.lang.StringtoString()
Returns a {@link String} representation of the header.

return
a string

        // no need for non-default formatting in toString()
        return BasicLineFormatter.DEFAULT.formatHeader(null, this).toString();