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
HTTP messages consist of requests from client to server and responses
from server to client.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header to this message.voidAdds a header to this message.Returns protocol version ornullwhen not available.booleanremoveHeader(Header header) Removes a header from this message.booleanremoveHeaders(String name) Removes all headers with a certain name from this message.voidOverwrites the first header with the same name.voidOverwrites 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 Details
-
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.
- 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
Adds a header to this message. The header will be appended to the end of the list.- Parameters:
header- the header to append.
-
addHeader
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
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
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
Overwrites all the headers in the message.- Parameters:
headers- the array of headers to set.
-
removeHeader
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
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.
-