One element of an HTTP header's value. More...
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.
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
BasicHeaderElement (final String name, final String value, final NameValuePair[] parameters) | |
Constructor with name, value and parameters. More... | |
BasicHeaderElement (final String name, final String value) | |
Constructor with name and value. More... | |
String | getName () |
Returns the name. More... | |
String | getValue () |
Returns the value. More... | |
NameValuePair[] | getParameters () |
Get parameters, if any. More... | |
int | getParameterCount () |
Obtains the number of parameters. More... | |
NameValuePair | getParameter (int index) |
Obtains the parameter with the given index. More... | |
NameValuePair | getParameterByName (final String name) |
Returns parameter with the given name, if found. More... | |
BasicHeaderElement | ( | final String | name, |
final String | value, | ||
final NameValuePair[] | parameters | ||
) |
name | header element name |
value | header element value. May be null |
parameters | header element parameters. May be null . Parameters are copied by reference, not by value |
BasicHeaderElement | ( | final String | name, |
final String | value | ||
) |
name | header element name |
value | header element value. May be null |
String getName | ( | ) |
Implements HeaderElement.
String getValue | ( | ) |
Implements HeaderElement.
NameValuePair [] getParameters | ( | ) |
The returned array is created for each invocation and can be modified by the caller without affecting this header element.
Implements HeaderElement.
int getParameterCount | ( | ) |
Implements HeaderElement.
NameValuePair getParameter | ( | int | index | ) |
index | the index of the parameter, 0-based |
Implements HeaderElement.
NameValuePair getParameterByName | ( | final String | name | ) |
Otherwise null is returned
name | The name to search by. |
Implements HeaderElement.