public abstract class HttpMessage extends WebMessage
A message sent over an HTTP connection. Can be either a request or a response.
| Constructor and Description |
|---|
HttpMessage() |
| Modifier and Type | Method and Description |
|---|---|
abstract Charset |
getCharacterEncoding()
The
Charset representing character encoding used in the body of this message. |
abstract int |
getContentLength()
The length, in bytes, of the message body and made available by the input stream, or
-1 if the length is not known or is greater than Integer.MAX_VALUE. |
abstract String |
getContentType()
The MIME type of the body of the request, or
null if the type is not known For example, text/html; charset=UTF-8. |
abstract Collection<Cookie> |
getCookies()
A collection all of the
Cookie objects the client sent with this message. |
String |
getHeader(String name)
Returns the value of the given header name.
|
abstract Multimap<String,String> |
getHeaders()
A multimap of the headers contained in this message and (all) their values.
|
Collection<String> |
getHeaderValues(String name)
Returns all values associated with the given header name
|
contentString, getByteBufferBody, getFrom, getStringBodytoStringpublic abstract Multimap<String,String> getHeaders()
A multimap of the headers contained in this message and (all) their values. If the request has no headers, returns an empty multimap.
public abstract Collection<Cookie> getCookies()
A collection all of the Cookie objects the client sent with this message. This method returns an empty collection if no cookies were sent.
public abstract int getContentLength()
The length, in bytes, of the message body and made available by the input stream, or -1 if the length is not known or is greater than Integer.MAX_VALUE.
public abstract Charset getCharacterEncoding()
The Charset representing character encoding used in the body of this message. This method returns null if the message does not specify a character encoding.
public abstract String getContentType()
The MIME type of the body of the request, or null if the type is not known For example, text/html; charset=UTF-8.
public Collection<String> getHeaderValues(String name)
Returns all values associated with the given header name
name - the header namepublic String getHeader(String name)
Returns the value of the given header name. If the header is not found in the message, this method returns null. If the header has more than one value, this method returns the first value.
name - the header namenull if the header is not found