org.jboss.netty.handler.codec.http
类 DefaultHttpMessage

java.lang.Object
  继承者 org.jboss.netty.handler.codec.http.DefaultHttpMessage
所有已实现的接口:
HttpMessage
直接已知子类:
DefaultHttpRequest, DefaultHttpResponse

public class DefaultHttpMessage
extends java.lang.Object
implements HttpMessage

The default HttpMessage implementation.


方法摘要
 void addHeader(java.lang.String name, java.lang.Object value)
          Adds a new header with the specified name and value.
 void clearHeaders()
          Removes all headers from this message.
 boolean containsHeader(java.lang.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()
          已过时。 
 long getContentLength(long defaultValue)
          已过时。 
 java.lang.String getHeader(java.lang.String name)
          Returns the header value with the specified header name.
 java.util.Set<java.lang.String> getHeaderNames()
          Returns the Set of all header names that this message contains.
 java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getHeaders()
          Returns the all header names and values that this message contains.
 java.util.List<java.lang.String> getHeaders(java.lang.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 this message does not have any content but the HttpChunks, which is generated by HttpMessageDecoder consecutively, contain the actual content.
 boolean isKeepAlive()
          已过时。 
 void removeHeader(java.lang.String name)
          Removes the header with the specified name.
 void setChunked(boolean chunked)
          Sets if this message does not have any content but the HttpChunks, which is generated by HttpMessageDecoder consecutively, contain the actual content.
 void setContent(ChannelBuffer content)
          Sets the content of this message.
 void setHeader(java.lang.String name, java.lang.Iterable<?> values)
          Sets a new header with the specified name and values.
 void setHeader(java.lang.String name, java.lang.Object value)
          Sets a new header with the specified name and value.
 void setProtocolVersion(HttpVersion version)
          Sets the protocol version of this message.
 java.lang.String toString()
           
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

方法详细信息

addHeader

public void addHeader(java.lang.String name,
                      java.lang.Object value)
从接口 HttpMessage 复制的描述
Adds a new header with the specified name and value.

指定者:
接口 HttpMessage 中的 addHeader

setHeader

public void setHeader(java.lang.String name,
                      java.lang.Object value)
从接口 HttpMessage 复制的描述
Sets a new header with the specified name and value. If there is an existing header with the same name, the existing header is removed.

指定者:
接口 HttpMessage 中的 setHeader

setHeader

public void setHeader(java.lang.String name,
                      java.lang.Iterable<?> values)
从接口 HttpMessage 复制的描述
Sets a new header with the specified name and values. If there is an existing header with the same name, the existing header is removed.

指定者:
接口 HttpMessage 中的 setHeader

removeHeader

public void removeHeader(java.lang.String name)
从接口 HttpMessage 复制的描述
Removes the header with the specified name.

指定者:
接口 HttpMessage 中的 removeHeader

getContentLength

@Deprecated
public long getContentLength()
已过时。 

指定者:
接口 HttpMessage 中的 getContentLength

getContentLength

@Deprecated
public long getContentLength(long defaultValue)
已过时。 

指定者:
接口 HttpMessage 中的 getContentLength

isChunked

public boolean isChunked()
从接口 HttpMessage 复制的描述
Returns true if and only if this message does not have any content but the HttpChunks, which is generated by HttpMessageDecoder 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 calling HttpMessage.setChunked(boolean) with false.

指定者:
接口 HttpMessage 中的 isChunked

setChunked

public void setChunked(boolean chunked)
从接口 HttpMessage 复制的描述
Sets if this message does not have any content but the HttpChunks, which is generated by HttpMessageDecoder consecutively, contain the actual content.

If this method is called with true, the content of this message becomes ChannelBuffers.EMPTY_BUFFER.

Even if this method is called with false, HttpMessage.isChunked() will keep returning true if the "Transfer-Encoding" of this message is "chunked".

指定者:
接口 HttpMessage 中的 setChunked

isKeepAlive

@Deprecated
public boolean isKeepAlive()
已过时。 

指定者:
接口 HttpMessage 中的 isKeepAlive

clearHeaders

public void clearHeaders()
从接口 HttpMessage 复制的描述
Removes all headers from this message.

指定者:
接口 HttpMessage 中的 clearHeaders

setContent

public void setContent(ChannelBuffer content)
从接口 HttpMessage 复制的描述
Sets the content of this message. If null is specified, the content of this message will be set to ChannelBuffers.EMPTY_BUFFER.

指定者:
接口 HttpMessage 中的 setContent

getHeader

public java.lang.String getHeader(java.lang.String name)
从接口 HttpMessage 复制的描述
Returns the header value with the specified header name. If there are more than one header value for the specified header name, the first value is returned.

指定者:
接口 HttpMessage 中的 getHeader
返回:
the header value or null if there is no such header

getHeaders

public java.util.List<java.lang.String> getHeaders(java.lang.String name)
从接口 HttpMessage 复制的描述
Returns the header values with the specified header name.

指定者:
接口 HttpMessage 中的 getHeaders
返回:
the List of header values. An empty list if there is no such header.

getHeaders

public java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getHeaders()
从接口 HttpMessage 复制的描述
Returns the all header names and values that this message contains.

指定者:
接口 HttpMessage 中的 getHeaders
返回:
the List of the header name-value pairs. An empty list if there is no header in this message.

containsHeader

public boolean containsHeader(java.lang.String name)
从接口 HttpMessage 复制的描述
Returns true if and only if there is a header with the specified header name.

指定者:
接口 HttpMessage 中的 containsHeader

getHeaderNames

public java.util.Set<java.lang.String> getHeaderNames()
从接口 HttpMessage 复制的描述
Returns the Set of all header names that this message contains.

指定者:
接口 HttpMessage 中的 getHeaderNames

getProtocolVersion

public HttpVersion getProtocolVersion()
从接口 HttpMessage 复制的描述
Returns the protocol version of this message.

指定者:
接口 HttpMessage 中的 getProtocolVersion

setProtocolVersion

public void setProtocolVersion(HttpVersion version)
从接口 HttpMessage 复制的描述
Sets the protocol version of this message.

指定者:
接口 HttpMessage 中的 setProtocolVersion

getContent

public ChannelBuffer getContent()
从接口 HttpMessage 复制的描述
Returns the content of this message. If there is no content or HttpMessage.isChunked() returns true, an ChannelBuffers.EMPTY_BUFFER is returned.

指定者:
接口 HttpMessage 中的 getContent

toString

public java.lang.String toString()
覆盖:
java.lang.Object 中的 toString