|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.httpclient.NameValuePair | +--org.apache.commons.httpclient.HeaderElement
One element of an HTTP header's value.
Some HTTP headers (such as the set-cookie header) have values that can be decomposed into multiple elements. Such headers must be in the following form:
header = [ element ] *( "," [ element ] ) element = name [ "=" [ value ] ] *( ";" [ param ] ) param = name [ "=" [ value ] ] name = token value = ( token | quoted-string ) token = 1*<any char except "=", ",", ";", <"> and white space> quoted-string = <"> *( text | quoted-char ) <"> text = any char except <"> quoted-char = "\" char
Any amount of white space is allowed between any part of the
header, element or param and is ignored. A missing value in any
element or param will be stored as the empty String
;
if the "=" is also missing null will be stored instead.
This class represents an individual header element, containing both a name/value pair (value may be null) and optionally a set of additional parameters.
This class also exposes a parse(java.lang.String)
method for parsing a
Header
value into an array of elements.
Header
, Serialized FormConstructor Summary | |
HeaderElement()
Default constructor. |
|
HeaderElement(java.lang.String name,
java.lang.String value)
Constructor. |
|
HeaderElement(java.lang.String name,
java.lang.String value,
NameValuePair[] parameters)
Constructor with name, value and parameters. |
Method Summary | |
NameValuePair |
getParameterByName(java.lang.String name)
Returns parameter with the given name, if found. |
NameValuePair[] |
getParameters()
Get parameters, if any. |
static HeaderElement[] |
parse(java.lang.String headerValue)
This parses the value part of a header. |
protected void |
setParameters(NameValuePair[] pairs)
|
Methods inherited from class org.apache.commons.httpclient.NameValuePair |
equals,
getName,
getValue,
hashCode,
setName,
setValue,
toString |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public HeaderElement()
public HeaderElement(java.lang.String name, java.lang.String value)
name
- my namevalue
- my (possibly null) valuepublic HeaderElement(java.lang.String name, java.lang.String value, NameValuePair[] parameters)
name
- my namevalue
- my (possibly null) valueparameters
- my (possibly null) parametersMethod Detail |
public NameValuePair[] getParameters()
NameValuePair
sprotected void setParameters(NameValuePair[] pairs)
pairs
- The new parameters. May be null.public static final HeaderElement[] parse(java.lang.String headerValue) throws HttpException
headerValue
- the string representation of the header value
(as received from the web server).Header
elements.public NameValuePair getParameterByName(java.lang.String name)
name
- The name to search by.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |