org.apache.http.message.HeaderGroup
A class for combining a set of headers.
This class allows for multiple headers with the same name and
keeps track of the order in which headers were added.
Summary
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
HeaderGroup()
Constructor for HeaderGroup.
Public Methods
public
void
addHeader(Header header)
Adds the given header to the group. The order in which this header was
added is preserved.
public
void
clear()
Removes any contained headers.
public
Object
clone()
Returns a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver.
Classes which wish to support cloning must specify that they implement
the Cloneable interface, since the implementation checks for this.
Returns
- Object a shallow copy of this object.
public
boolean
containsHeader(String name)
Tests if headers with the given name are contained within this group.
Header name comparison is case insensitive.
Parameters
name
| the header name to test for |
Returns
true
if at least one header with the name is
contained, false
otherwise
Returns a copy of this object
public
Header[]
getAllHeaders()
Gets all of the headers contained within this group.
public
Header
getCondensedHeader(String name)
Gets a header representing all of the header values with the given name.
If more that one header with the given name exists the values will be
combined with a "," as per RFC 2616.
Header name comparison is case insensitive.
Parameters
name
| the name of the header(s) to get |
Returns
- a header with a condensed value or
null
if no
headers by the given name are present
public
Header
getFirstHeader(String name)
Gets the first header with the given name.
Header name comparison is case insensitive.
Parameters
name
| the name of the header to get |
Gets all of the headers with the given name. The returned array
maintains the relative order in which the headers were added.
Header name comparison is case insensitive.
Parameters
name
| the name of the header(s) to get |
public
Header
getLastHeader(String name)
Gets the last header with the given name.
Header name comparison is case insensitive.
Parameters
name
| the name of the header to get |
Returns an iterator over this group of headers.
Returns
- iterator over this group of headers.
Returns an iterator over the headers with a given name in this group.
Parameters
name
| the name of the headers over which to iterate, or
null for all headers |
Returns
- iterator over some headers in this group.
public
void
removeHeader(Header header)
Removes the given header.
Parameters
header
| the header to remove
|
public
void
setHeaders(Header[] headers)
Sets all of the headers contained within this group overriding any
existing headers. The headers are added in the order in which they appear
in the array.
Parameters
headers
| the headers to set
|
public
void
updateHeader(Header header)
Replaces the first occurence of the header with the same name. If no header with
the same name is found the given header is added to the end of the list.
Parameters
header
| the new header that should replace the first header with the same
name if present in the list.
|