Package org.apache.hc.core5.http
Interface HttpMessage
-
- All Superinterfaces:
MessageHeaders
- All Known Subinterfaces:
ClassicHttpRequest,ClassicHttpResponse,HttpRequest,HttpResponse
- All Known Implementing Classes:
AbstractMessageWrapper,BasicClassicHttpRequest,BasicClassicHttpResponse,BasicHttpRequest,BasicHttpResponse,HttpRequestWrapper,HttpResponseWrapper
public interface HttpMessage extends MessageHeaders
HTTP messages consist of requests from client to server and responses from server to client.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddHeader(java.lang.String name, java.lang.Object value)Adds a header to this message.voidaddHeader(Header header)Adds a header to this message.ProtocolVersiongetVersion()Returns protocol version ornullwhen not available.booleanremoveHeader(Header header)Removes a header from this message.booleanremoveHeaders(java.lang.String name)Removes all headers with a certain name from this message.voidsetHeader(java.lang.String name, java.lang.Object value)Overwrites the first header with the same name.voidsetHeader(Header header)Overwrites the first header with the same name.voidsetHeaders(Header... headers)Overwrites all the headers in the message.voidsetVersion(ProtocolVersion version)Sets protocol version.-
Methods inherited from interface org.apache.hc.core5.http.MessageHeaders
containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
-
-
-
-
Method Detail
-
setVersion
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
-
getVersion
ProtocolVersion getVersion()
Returns protocol version ornullwhen 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
-
addHeader
void addHeader(Header header)
Adds a header to this message. The header will be appended to the end of the list.- Parameters:
header- the header to append.
-
addHeader
void addHeader(java.lang.String name, java.lang.Object value)Adds a header to this message. The header will be appended to the end of the list.- Parameters:
name- the name of the header.value- the value of the header, taken as the value'sObject.toString().
-
setHeader
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- the header to set.
-
setHeader
void setHeader(java.lang.String name, java.lang.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- the name of the header.value- the value of the header, taken as the value'sObject.toString().
-
setHeaders
void setHeaders(Header... headers)
Overwrites all the headers in the message.- Parameters:
headers- the array of headers to set.
-
removeHeader
boolean removeHeader(Header header)
Removes a header from this message.- Parameters:
header- the header to remove.- Returns:
trueif a header was removed as a result of this call.
-
removeHeaders
boolean removeHeaders(java.lang.String name)
Removes all headers with a certain name from this message.- Parameters:
name- The name of the headers to remove.- Returns:
trueif any header was removed as a result of this call.
-
-