public class DefaultHttpMessage extends Object implements HttpMessage
HttpMessage
implementation.Modifier | Constructor and Description |
---|---|
protected |
DefaultHttpMessage(HttpVersion version)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
String value)
Adds a new header with the specified name and value.
|
void |
clearHeaders()
Removes all headers from this message.
|
boolean |
containsHeader(String name)
Returns
true if and only if there is a header with the specified
header name. |
ChannelBuffer |
getContent()
Returns the content of this message.
|
long |
getContentLength()
Returns the length of the content.
|
long |
getContentLength(long defaultValue)
Returns the length of the content.
|
String |
getHeader(String name)
Returns the header value with the specified header name.
|
Set<String> |
getHeaderNames()
Returns the
Set of all header names that this message contains. |
List<String> |
getHeaders(String name)
Returns the header values with the specified header name.
|
HttpVersion |
getProtocolVersion()
Returns the protocol version of this message.
|
boolean |
isChunked()
Returns
true if and only if the "Transfer-Encoding" of
this message is "chunked" . |
boolean |
isKeepAlive()
Returns
true if and only if the connection can remain open and
thus 'kept alive'. |
void |
removeHeader(String name)
Removes the header with the specified name.
|
void |
setContent(ChannelBuffer content)
Sets the content of this message.
|
void |
setHeader(String name,
Iterable<String> values)
Sets a new header with the specified name and values.
|
void |
setHeader(String name,
String value)
Sets a new header with the specified name and value.
|
protected DefaultHttpMessage(HttpVersion version)
public void addHeader(String name, String value)
HttpMessage
addHeader
in interface HttpMessage
public void setHeader(String name, String value)
HttpMessage
setHeader
in interface HttpMessage
public void setHeader(String name, Iterable<String> values)
HttpMessage
setHeader
in interface HttpMessage
public void removeHeader(String name)
HttpMessage
removeHeader
in interface HttpMessage
public long getContentLength()
HttpMessage
HttpMessage.getContent()
but from the
"Content-Length"
header, and thus they are independent from each
other.getContentLength
in interface HttpMessage
0
if this message does not have
the "Content-Length"
headerpublic long getContentLength(long defaultValue)
HttpMessage
HttpMessage.getContent()
but from the
"Content-Length"
header, and thus they are independent from each
other.getContentLength
in interface HttpMessage
defaultValue
if this message does
not have the "Content-Length"
headerpublic boolean isChunked()
HttpMessage
true
if and only if the "Transfer-Encoding"
of
this message is "chunked"
.isChunked
in interface HttpMessage
public boolean isKeepAlive()
HttpMessage
true
if and only if the connection can remain open and
thus 'kept alive'.isKeepAlive
in interface HttpMessage
public void clearHeaders()
HttpMessage
clearHeaders
in interface HttpMessage
public void setContent(ChannelBuffer content)
HttpMessage
null
is specified,
the content of this message will be set to ChannelBuffers.EMPTY_BUFFER
.setContent
in interface HttpMessage
public String getHeader(String name)
HttpMessage
getHeader
in interface HttpMessage
null
if there is no such headerpublic List<String> getHeaders(String name)
HttpMessage
getHeaders
in interface HttpMessage
List
of header values. An empty list if there is no
such header.public boolean containsHeader(String name)
HttpMessage
true
if and only if there is a header with the specified
header name.containsHeader
in interface HttpMessage
public Set<String> getHeaderNames()
HttpMessage
Set
of all header names that this message contains.getHeaderNames
in interface HttpMessage
public HttpVersion getProtocolVersion()
HttpMessage
getProtocolVersion
in interface HttpMessage
public ChannelBuffer getContent()
HttpMessage
ChannelBuffers.EMPTY_BUFFER
is returned.getContent
in interface HttpMessage
Copyright © 2008–2013 JBoss, by Red Hat. All rights reserved.