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 java.lang.Object implements HttpMessage
The defaultHttpMessageimplementation.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanchunkedprivate ChannelBuffercontentprivate HttpHeadersheadersprivate HttpVersionversion
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultHttpMessage(HttpVersion version)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidappendHeaders(java.lang.StringBuilder buf)ChannelBuffergetContent()Returns the content of this message.HttpVersiongetProtocolVersion()Returns the protocol version of this message.HttpHeadersheaders()Returns the headers of this message.booleanisChunked()Returnstrueif and only if this message does not have any content but theHttpChunks, which is generated byHttpMessageDecoderconsecutively, contain the actual content.voidsetChunked(boolean chunked)Sets if this message does not have any content but theHttpChunks, which is generated byHttpMessageDecoderconsecutively, contain the actual content.voidsetContent(ChannelBuffer content)Sets the content of this message.voidsetProtocolVersion(HttpVersion version)Sets the protocol version of this message.java.lang.StringtoString()
-
-
-
Field Detail
-
headers
private final HttpHeaders headers
-
version
private HttpVersion version
-
content
private ChannelBuffer content
-
chunked
private boolean chunked
-
-
Constructor Detail
-
DefaultHttpMessage
protected DefaultHttpMessage(HttpVersion version)
Creates a new instance.
-
-
Method Detail
-
headers
public HttpHeaders headers()
Description copied from interface:HttpMessageReturns the headers of this message.- Specified by:
headersin interfaceHttpMessage
-
isChunked
public boolean isChunked()
Description copied from interface:HttpMessageReturnstrueif and only if this message does not have any content but theHttpChunks, which is generated byHttpMessageDecoderconsecutively, contain the actual content.Please note that this method will keep returning
trueif the"Transfer-Encoding"of this message is"chunked", even if you attempt to override this property by callingHttpMessage.setChunked(boolean)withfalse.- Specified by:
isChunkedin interfaceHttpMessage
-
setChunked
public void setChunked(boolean chunked)
Description copied from interface:HttpMessageSets if this message does not have any content but theHttpChunks, which is generated byHttpMessageDecoderconsecutively, 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 returningtrueif the"Transfer-Encoding"of this message is"chunked".- Specified by:
setChunkedin interfaceHttpMessage
-
setContent
public void setContent(ChannelBuffer content)
Description copied from interface:HttpMessageSets the content of this message. Ifnullis specified, the content of this message will be set toChannelBuffers.EMPTY_BUFFER.- Specified by:
setContentin interfaceHttpMessage
-
getProtocolVersion
public HttpVersion getProtocolVersion()
Description copied from interface:HttpMessageReturns the protocol version of this message.- Specified by:
getProtocolVersionin interfaceHttpMessage
-
setProtocolVersion
public void setProtocolVersion(HttpVersion version)
Description copied from interface:HttpMessageSets the protocol version of this message.- Specified by:
setProtocolVersionin interfaceHttpMessage
-
getContent
public ChannelBuffer getContent()
Description copied from interface:HttpMessageReturns the content of this message. If there is no content orHttpMessage.isChunked()returnstrue, anChannelBuffers.EMPTY_BUFFERis returned.- Specified by:
getContentin interfaceHttpMessage
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
appendHeaders
void appendHeaders(java.lang.StringBuilder buf)
-
-