Top Description Methods
org.apache.hc.core5.http

public Interface MessageHeaders

Known Direct Subinterfaces
org.apache.hc.core5.http.HttpMessage
Known Direct Implementers
org.apache.hc.core5.http.message.HeaderGroup
Imports
java.util.Iterator

Messages head consisting of multiple message headers.
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if at least one header with this name is present.
containsHeader
(String
the header name to check for.
name
)

Checks if a certain header is present in this message.

public int

Returns:

number of occurrences of the header in the message.
countHeaders
(String
the header name to check for.
name
)

Checks if a certain header is present in this message and how many times.

public Header

Returns:

the first header whose name property equals name or null if no such header could be found.
getFirstHeader
(String
the name of the header to return.
name
)

Returns the first header with a specified name of this message.

public Header

Returns:

the first header or null
getHeader
(String
the name of the header to get
name
)

Gets single first header with the given name.

public Header[]

Returns:

all the headers of this message
getHeaders
()

Returns all the headers of this message.

public Header[]

Returns:

the headers whose name property equals name.
getHeaders
(String
the name of the headers to return.
name
)

Returns all the headers with a specified name of this message.

public Header

Returns:

the last header whose name property equals name. or null if no such header could be found.
getLastHeader
(String
the name of the header to return.
name
)

Returns the last header with a specified name of this message.

public Iterator<Header>

Returns:

Iterator that returns Header objects in the sequence they are sent over a connection.
headerIterator
()

Returns an iterator of all the headers.

public Iterator<Header>

Returns:

Iterator that returns Header objects with the argument name in the sequence they are sent over a connection.
headerIterator
(String
the name of the headers over which to iterate, or null for all headers
name
)

Returns an iterator of the headers with a given name.

Method Detail

containsHeaderback to summary
public boolean containsHeader(String name)

Checks if a certain header is present in this message. Header values are ignored.

Parameters
name:String

the header name to check for.

Returns:boolean

true if at least one header with this name is present.

countHeadersback to summary
public int countHeaders(String name)

Checks if a certain header is present in this message and how many times.

Parameters
name:String

the header name to check for.

Returns:int

number of occurrences of the header in the message.

getFirstHeaderback to summary
public Header getFirstHeader(String name)

Returns the first header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the first element of getHeaders(String) is returned. If there is no matching header in the message null is returned.

Parameters
name:String

the name of the header to return.

Returns:Header

the first header whose name property equals name or null if no such header could be found.

getHeaderback to summary
public Header getHeader(String name) throws ProtocolException

Gets single first header with the given name.

Header name comparison is case insensitive.

Parameters
name:String

the name of the header to get

Returns:Header

the first header or null

Exceptions
ProtocolException:
in case multiple headers with the given name are found.
getHeadersback to summary
public Header[] getHeaders()

Returns all the headers of this message. Headers are ordered in the sequence they will be sent over a connection.

Returns:Header[]

all the headers of this message

getHeadersback to summary
public Header[] getHeaders(String name)

Returns all the headers with a specified name of this message. Header values are ignored. Headers are ordered in the sequence they will be sent over a connection.

Parameters
name:String

the name of the headers to return.

Returns:Header[]

the headers whose name property equals name.

getLastHeaderback to summary
public Header getLastHeader(String name)

Returns the last header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the last element of getHeaders(String) is returned. If there is no matching header in the message null is returned.

Parameters
name:String

the name of the header to return.

Returns:Header

the last header whose name property equals name. or null if no such header could be found.

headerIteratorback to summary
public Iterator<Header> headerIterator()

Returns an iterator of all the headers.

Returns:Iterator<Header>

Iterator that returns Header objects in the sequence they are sent over a connection.

headerIteratorback to summary
public Iterator<Header> headerIterator(String name)

Returns an iterator of the headers with a given name.

Parameters
name:String

the name of the headers over which to iterate, or null for all headers

Returns:Iterator<Header>

Iterator that returns Header objects with the argument name in the sequence they are sent over a connection.