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

public Interface HttpMessage

extends MessageHeaders
Known Direct Subinterfaces
org.apache.hc.core5.http.HttpRequest, org.apache.hc.core5.http.HttpResponse
Known Direct Implementers
org.apache.hc.core5.http.message.AbstractMessageWrapper

HTTP messages consist of requests from client to server and responses from server to client.
Since
4.0

Method Summary

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

Adds a header to this message.

public void
addHeader(String
the name of the header.
name
,
Object
the value of the header, taken as the value's Object#toString().
value
)

Adds a header to this message.

public ProtocolVersion
getVersion()

Returns protocol version or null when not available.

public boolean

Returns:

true if a header was removed as a result of this call.
removeHeader
(Header
the header to remove.
header
)

Removes a header from this message.

public boolean

Returns:

true if any header was removed as a result of this call.
removeHeaders
(String
The name of the headers to remove.
name
)

Removes all headers with a certain name from this message.

public void
setHeader(Header
the header to set.
header
)

Overwrites the first header with the same name.

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

Overwrites the first header with the same name.

public void
setHeaders(Header...
the array of headers to set.
headers
)

Overwrites all the headers in the message.

public void
setVersion(ProtocolVersion version)

Sets protocol version.

Inherited from org.apache.hc.core5.http.MessageHeaders:
containsHeadercountHeadersgetFirstHeadergetHeadergetHeadersgetHeadersgetLastHeaderheaderIteratorheaderIterator

Method Detail

addHeaderback to summary
public void addHeader(Header header)

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

Parameters
header:Header

the header to append.

addHeaderback to summary
public void addHeader(String name, Object value)

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

getVersionback to summary
public ProtocolVersion 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.

Since
5.0
removeHeaderback to summary
public boolean removeHeader(Header header)

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.

removeHeadersback to summary
public boolean removeHeaders(String name)

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.

setHeaderback to summary
public void setHeader(Header header)

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.

setHeaderback to summary
public void setHeader(String name, Object value)

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

setHeadersback to summary
public void setHeaders(Header... headers)

Overwrites all the headers in the message.

Parameters
headers:Header[]

the array of headers to set.

setVersionback to summary
public void setVersion(ProtocolVersion version)

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.

Since
5.0