Package org.apache.commons.httpclient
Class HeaderElement
- java.lang.Object
-
- org.apache.commons.httpclient.NameValuePair
-
- org.apache.commons.httpclient.HeaderElement
-
- All Implemented Interfaces:
java.io.Serializable
@Deprecated public class HeaderElement extends NameValuePair
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.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 aHeader
value into an array of elements.- Since:
- 1.0
- See Also:
Header
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HeaderElement()
Deprecated.Default constructor.HeaderElement(char[] chars)
Deprecated.Constructor with array of characters.HeaderElement(char[] chars, int offset, int length)
Deprecated.Constructor with array of characters.HeaderElement(java.lang.String name, java.lang.String value)
Deprecated.Constructor.HeaderElement(java.lang.String name, java.lang.String value, NameValuePair[] parameters)
Deprecated.Constructor with name, value and parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description NameValuePair
getParameterByName(java.lang.String name)
Deprecated.Returns parameter with the given name, if found.NameValuePair[]
getParameters()
Deprecated.Get parameters, if any.static HeaderElement[]
parse(java.lang.String headerValue)
Deprecated.Use #parseElements(String).static HeaderElement[]
parseElements(char[] headerValue)
Deprecated.This parses the value part of a header.static HeaderElement[]
parseElements(java.lang.String headerValue)
Deprecated.This parses the value part of a header.
-
-
-
Constructor Detail
-
HeaderElement
public HeaderElement()
Deprecated.Default constructor.
-
HeaderElement
public HeaderElement(java.lang.String name, java.lang.String value)
Deprecated.Constructor.- Parameters:
name
- my namevalue
- my (possibly null) value
-
HeaderElement
public HeaderElement(java.lang.String name, java.lang.String value, NameValuePair[] parameters)
Deprecated.Constructor with name, value and parameters.- Parameters:
name
- my namevalue
- my (possibly null) valueparameters
- my (possibly null) parameters
-
HeaderElement
public HeaderElement(char[] chars, int offset, int length)
Deprecated.Constructor with array of characters.- Parameters:
chars
- the array of charactersoffset
- - the initial offset.length
- - the length.- Since:
- 3.0
-
HeaderElement
public HeaderElement(char[] chars)
Deprecated.Constructor with array of characters.- Parameters:
chars
- the array of characters- Since:
- 3.0
-
-
Method Detail
-
getParameters
public NameValuePair[] getParameters()
Deprecated.Get parameters, if any.- Returns:
- parameters as an array of
NameValuePair
s - Since:
- 2.0
-
parseElements
public static final HeaderElement[] parseElements(char[] headerValue)
Deprecated.This parses the value part of a header. The result is an array of HeaderElement objects.- Parameters:
headerValue
- the array of char representation of the header value (as received from the web server).- Returns:
- array of
HeaderElement
s. - Since:
- 3.0
-
parseElements
public static final HeaderElement[] parseElements(java.lang.String headerValue)
Deprecated.This parses the value part of a header. The result is an array of HeaderElement objects.- Parameters:
headerValue
- the string representation of the header value (as received from the web server).- Returns:
- array of
HeaderElement
s. - Since:
- 3.0
-
parse
public static final HeaderElement[] parse(java.lang.String headerValue) throws HttpException
Deprecated.Use #parseElements(String).This parses the value part of a header. The result is an array of HeaderElement objects.- Parameters:
headerValue
- the string representation of the header value (as received from the web server).- Returns:
- array of
HeaderElement
s. - Throws:
HttpException
- if the above syntax rules are violated.
-
getParameterByName
public NameValuePair getParameterByName(java.lang.String name)
Deprecated.Returns parameter with the given name, if found. Otherwise null is returned- Parameters:
name
- The name to search by.- Returns:
- NameValuePair parameter with the given name
-
-