Top Description Fields Constructors Methods
org.apache.hc.core5.http.message

public abstract Class AbstractMessageWrapper<T extends org.apache.hc.core5.http.HttpMessage>

extends Object
implements HttpMessage
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.HttpMessage, org.apache.hc.core5.http.MessageHeaders
Known Direct Subclasses
org.apache.hc.core5.http.message.HttpRequestWrapper, org.apache.hc.core5.http.message.HttpResponseWrapper
Type Parameters
<T>
A HttpMessage type.
Imports
java.util.Iterator, org.apache.hc.core5.http.Header, .HttpMessage, .ProtocolException, .ProtocolVersion, org.apache.hc.core5.util.Args

Abstract HttpMessage wrapper.

Field Summary

Modifier and TypeField and Description
private final T

Constructor Summary

AccessConstructor and Description
public
AbstractMessageWrapper(final T message)

Method Summary

Modifier and TypeMethod and Description
public void
addHeader(final Header
the header to append.
header
)

Implements org.apache.hc.core5.http.HttpMessage.addHeader.

Adds a header to this message.
public void
addHeader(final String
the name of the header.
name
,
final Object
the value of the header, taken as the value's Object#toString().
value
)

Implements org.apache.hc.core5.http.HttpMessage.addHeader.

Adds a header to this message.
public boolean
containsHeader(final String
the header name to check for.
name
)

Implements org.apache.hc.core5.http.MessageHeaders.containsHeader.

Checks if a certain header is present in this message.
public int
countHeaders(final String
the header name to check for.
name
)

Implements org.apache.hc.core5.http.MessageHeaders.countHeaders.

Checks if a certain header is present in this message and how many times.
public Header
getFirstHeader(final String
the name of the header to return.
name
)

Implements org.apache.hc.core5.http.MessageHeaders.getFirstHeader.

Returns the first header with a specified name of this message.
public Header
getHeader(final String
the name of the header to get
name
)

Implements org.apache.hc.core5.http.MessageHeaders.getHeader.

Gets single first header with the given name.
public Header[]
getHeaders(final String
the name of the headers to return.
name
)

Implements org.apache.hc.core5.http.MessageHeaders.getHeaders.

Returns all the headers with a specified name of this message.
public Header[]
getHeaders()

Implements org.apache.hc.core5.http.MessageHeaders.getHeaders.

Returns all the headers of this message.
public Header
getLastHeader(final String
the name of the header to return.
name
)

Implements org.apache.hc.core5.http.MessageHeaders.getLastHeader.

Returns the last header with a specified name of this message.
pack-priv T
public ProtocolVersion
getVersion()

Implements org.apache.hc.core5.http.HttpMessage.getVersion.

Returns protocol version or null when not available.
public Iterator<Header>
headerIterator()

Implements org.apache.hc.core5.http.MessageHeaders.headerIterator.

Returns an iterator of all the headers.
public Iterator<Header>
headerIterator(final String
the name of the headers over which to iterate, or null for all headers
name
)

Implements org.apache.hc.core5.http.MessageHeaders.headerIterator.

Returns an iterator of the headers with a given name.
public boolean
removeHeader(final Header
the header to remove.
header
)

Implements org.apache.hc.core5.http.HttpMessage.removeHeader.

Removes a header from this message.
public boolean
removeHeaders(final String
The name of the headers to remove.
name
)

Implements org.apache.hc.core5.http.HttpMessage.removeHeaders.

Removes all headers with a certain name from this message.
public void
setHeader(final Header
the header to set.
header
)

Implements org.apache.hc.core5.http.HttpMessage.setHeader.

Overwrites the first header with the same name.
public void
setHeader(final String
the name of the header.
name
,
final Object
the value of the header, taken as the value's Object#toString().
value
)

Implements org.apache.hc.core5.http.HttpMessage.setHeader.

Overwrites the first header with the same name.
public void
setHeaders(final Header...
the array of headers to set.
headers
)

Implements org.apache.hc.core5.http.HttpMessage.setHeaders.

Overwrites all the headers in the message.
public void
setVersion(final ProtocolVersion version)

Implements org.apache.hc.core5.http.HttpMessage.setVersion.

Sets protocol version.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

messageback to summary
private final T message

Constructor Detail

AbstractMessageWrapperback to summary
public AbstractMessageWrapper(final T message)

Method Detail

addHeaderback to summary
public void addHeader(final Header header)

Implements org.apache.hc.core5.http.HttpMessage.addHeader.

Doc from org.apache.hc.core5.http.HttpMessage.addHeader.

Adds a header to this message. The header will be appended to the end of the list.

Parameters
header:Header

the header to append.

Annotations
@Override
addHeaderback to summary
public void addHeader(final String name, final Object value)

Implements org.apache.hc.core5.http.HttpMessage.addHeader.

Doc from org.apache.hc.core5.http.HttpMessage.addHeader.

Adds a header to this message. The header will be appended to the end of the list.

Parameters
name:String

the name of the header.

value:Object

the value of the header, taken as the value's Object#toString().

Annotations
@Override
containsHeaderback to summary
public boolean containsHeader(final String name)

Implements org.apache.hc.core5.http.MessageHeaders.containsHeader.

Doc from org.apache.hc.core5.http.MessageHeaders.containsHeader.

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.

Annotations
@Override
countHeadersback to summary
public int countHeaders(final String name)

Implements org.apache.hc.core5.http.MessageHeaders.countHeaders.

Doc from org.apache.hc.core5.http.MessageHeaders.countHeaders.

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.

Annotations
@Override
getFirstHeaderback to summary
public Header getFirstHeader(final String name)

Implements org.apache.hc.core5.http.MessageHeaders.getFirstHeader.

Doc from org.apache.hc.core5.http.MessageHeaders.getFirstHeader.

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.

Annotations
@Override
getHeaderback to summary
public Header getHeader(final String name) throws ProtocolException

Implements org.apache.hc.core5.http.MessageHeaders.getHeader.

Doc from org.apache.hc.core5.http.MessageHeaders.getHeader.

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

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

Implements org.apache.hc.core5.http.MessageHeaders.getHeaders.

Doc from org.apache.hc.core5.http.MessageHeaders.getHeaders.

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.

Annotations
@Override
getHeadersback to summary
public Header[] getHeaders()

Implements org.apache.hc.core5.http.MessageHeaders.getHeaders.

Doc from org.apache.hc.core5.http.MessageHeaders.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

Annotations
@Override
getLastHeaderback to summary
public Header getLastHeader(final String name)

Implements org.apache.hc.core5.http.MessageHeaders.getLastHeader.

Doc from org.apache.hc.core5.http.MessageHeaders.getLastHeader.

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.

Annotations
@Override
getMessageback to summary
pack-priv T getMessage()
getVersionback to summary
public ProtocolVersion getVersion()

Implements org.apache.hc.core5.http.HttpMessage.getVersion.

Doc from org.apache.hc.core5.http.HttpMessage.getVersion.

Returns protocol version or null when not available.

For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.

Annotations
@Override
headerIteratorback to summary
public Iterator<Header> headerIterator()

Implements org.apache.hc.core5.http.MessageHeaders.headerIterator.

Doc from org.apache.hc.core5.http.MessageHeaders.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.

Annotations
@Override
headerIteratorback to summary
public Iterator<Header> headerIterator(final String name)

Implements org.apache.hc.core5.http.MessageHeaders.headerIterator.

Doc from org.apache.hc.core5.http.MessageHeaders.headerIterator.

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.

Annotations
@Override
removeHeaderback to summary
public boolean removeHeader(final Header header)

Implements org.apache.hc.core5.http.HttpMessage.removeHeader.

Doc from org.apache.hc.core5.http.HttpMessage.removeHeader.

Removes a header from this message.

Parameters
header:Header

the header to remove.

Returns:boolean

true if a header was removed as a result of this call.

Annotations
@Override
removeHeadersback to summary
public boolean removeHeaders(final String name)

Implements org.apache.hc.core5.http.HttpMessage.removeHeaders.

Doc from org.apache.hc.core5.http.HttpMessage.removeHeaders.

Removes all headers with a certain name from this message.

Parameters
name:String

The name of the headers to remove.

Returns:boolean

true if any header was removed as a result of this call.

Annotations
@Override
setHeaderback to summary
public void setHeader(final Header header)

Implements org.apache.hc.core5.http.HttpMessage.setHeader.

Doc from org.apache.hc.core5.http.HttpMessage.setHeader.

Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.

Parameters
header:Header

the header to set.

Annotations
@Override
setHeaderback to summary
public void setHeader(final String name, final Object value)

Implements org.apache.hc.core5.http.HttpMessage.setHeader.

Doc from org.apache.hc.core5.http.HttpMessage.setHeader.

Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.

Parameters
name:String

the name of the header.

value:Object

the value of the header, taken as the value's Object#toString().

Annotations
@Override
setHeadersback to summary
public void setHeaders(final Header... headers)

Implements org.apache.hc.core5.http.HttpMessage.setHeaders.

Doc from org.apache.hc.core5.http.HttpMessage.setHeaders.

Overwrites all the headers in the message.

Parameters
headers:Header[]

the array of headers to set.

Annotations
@Override
setVersionback to summary
public void setVersion(final ProtocolVersion version)

Implements org.apache.hc.core5.http.HttpMessage.setVersion.

Doc from org.apache.hc.core5.http.HttpMessage.setVersion.

Sets protocol version.

For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override