• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
BasicHeaderElement Class Reference

One element of an HTTP header's value. More...

Inheritance diagram for BasicHeaderElement:
HeaderElement

Description

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.

Author
B.C. Holmes
Park, Sung-Gu
Mike Bowler
Oleg Kalnichevski
Version
Revision
604625
Date
2007-12-16 06:11:11 -0800 (Sun, 16 Dec 2007)
Since
4.0

Notice

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...
 

Constructor & Destructor Documentation

◆ BasicHeaderElement() [1/2]

BasicHeaderElement ( final String  name,
final String  value,
final NameValuePair[]  parameters 
)
Parameters
nameheader element name
valueheader element value. May be null
parametersheader element parameters. May be null. Parameters are copied by reference, not by value

◆ BasicHeaderElement() [2/2]

BasicHeaderElement ( final String  name,
final String  value 
)
Parameters
nameheader element name
valueheader element value. May be null

Member Function Documentation

◆ getName()

String getName ( )
Returns
String name The name

Implements HeaderElement.

◆ getValue()

String getValue ( )
Returns
String value The current value.

Implements HeaderElement.

◆ getParameters()

NameValuePair [] getParameters ( )

The returned array is created for each invocation and can be modified by the caller without affecting this header element.

Returns
parameters as an array of com.good.gd.apache.http.NameValuePair

Implements HeaderElement.

◆ getParameterCount()

int getParameterCount ( )
Returns
the number of parameters

Implements HeaderElement.

◆ getParameter()

NameValuePair getParameter ( int  index)
Parameters
indexthe index of the parameter, 0-based
Returns
the parameter with the given index

Implements HeaderElement.

◆ getParameterByName()

NameValuePair getParameterByName ( final String  name)

Otherwise null is returned

Parameters
nameThe name to search by.
Returns
NameValuePair parameter with the given name

Implements HeaderElement.