Class DefaultHttpMessage
- java.lang.Object
-
- org.jboss.netty.handler.codec.http.DefaultHttpMessage
-
- All Implemented Interfaces:
HttpMessage
- Direct Known Subclasses:
DefaultHttpRequest
,DefaultHttpResponse
public class DefaultHttpMessage extends Object implements HttpMessage
The defaultHttpMessage
implementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultHttpMessage(HttpVersion version)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelBuffer
getContent()
Returns the content of this message.HttpVersion
getProtocolVersion()
Returns the protocol version of this message.HttpHeaders
headers()
Returns the headers of this message.boolean
isChunked()
Returnstrue
if and only if this message does not have any content but theHttpChunk
s, which is generated byHttpMessageDecoder
consecutively, contain the actual content.void
setChunked(boolean chunked)
Sets if this message does not have any content but theHttpChunk
s, which is generated byHttpMessageDecoder
consecutively, contain the actual content.void
setContent(ChannelBuffer content)
Sets the content of this message.void
setProtocolVersion(HttpVersion version)
Sets the protocol version of this message.String
toString()
-
-
-
Constructor Detail
-
DefaultHttpMessage
protected DefaultHttpMessage(HttpVersion version)
Creates a new instance.
-
-
Method Detail
-
headers
public HttpHeaders headers()
Description copied from interface:HttpMessage
Returns the headers of this message.- Specified by:
headers
in interfaceHttpMessage
-
isChunked
public boolean isChunked()
Description copied from interface:HttpMessage
Returnstrue
if and only if this message does not have any content but theHttpChunk
s, which is generated byHttpMessageDecoder
consecutively, contain the actual content.Please note that this method will keep returning
true
if the"Transfer-Encoding"
of this message is"chunked"
, even if you attempt to override this property by callingHttpMessage.setChunked(boolean)
withfalse
.- Specified by:
isChunked
in interfaceHttpMessage
-
setChunked
public void setChunked(boolean chunked)
Description copied from interface:HttpMessage
Sets if this message does not have any content but theHttpChunk
s, which is generated byHttpMessageDecoder
consecutively, contain the actual content.If this method is called with
true
, the content of this message becomesChannelBuffers.EMPTY_BUFFER
.Even if this method is called with
false
,HttpMessage.isChunked()
will keep returningtrue
if the"Transfer-Encoding"
of this message is"chunked"
.- Specified by:
setChunked
in interfaceHttpMessage
-
setContent
public void setContent(ChannelBuffer content)
Description copied from interface:HttpMessage
Sets the content of this message. Ifnull
is specified, the content of this message will be set toChannelBuffers.EMPTY_BUFFER
.- Specified by:
setContent
in interfaceHttpMessage
-
getProtocolVersion
public HttpVersion getProtocolVersion()
Description copied from interface:HttpMessage
Returns the protocol version of this message.- Specified by:
getProtocolVersion
in interfaceHttpMessage
-
setProtocolVersion
public void setProtocolVersion(HttpVersion version)
Description copied from interface:HttpMessage
Sets the protocol version of this message.- Specified by:
setProtocolVersion
in interfaceHttpMessage
-
getContent
public ChannelBuffer getContent()
Description copied from interface:HttpMessage
Returns the content of this message. If there is no content orHttpMessage.isChunked()
returnstrue
, anChannelBuffers.EMPTY_BUFFER
is returned.- Specified by:
getContent
in interfaceHttpMessage
-
-