org.glassfish.grizzly.http
Class HttpContent

java.lang.Object
  extended by org.glassfish.grizzly.http.HttpPacket
      extended by org.glassfish.grizzly.http.HttpContent
All Implemented Interfaces:
Appendable<HttpContent>, Cacheable
Direct Known Subclasses:
HttpBrokenContent, HttpTrailer

public class HttpContent
extends HttpPacket
implements Appendable<HttpContent>

Object represents HTTP message content: complete or part. The HttpContent object could be used both with fixed-size and chunked HTTP messages. To get the HTTP message header - call getHttpHeader(). To build HttpContent message, use HttpContent.Builder object, which could be get following way: builder(org.glassfish.grizzly.http.HttpHeader).

Author:
Alexey Stashok
See Also:
HttpPacket, HttpHeader

Nested Class Summary
static class HttpContent.Builder<T extends HttpContent.Builder>
          HttpContent message builder.
 
Field Summary
protected  Buffer content
           
protected  HttpHeader httpHeader
           
protected  boolean isLast
           
 
Constructor Summary
protected HttpContent()
           
protected HttpContent(HttpHeader httpHeader)
           
 
Method Summary
 HttpContent append(HttpContent element)
           
static HttpContent.Builder builder(HttpHeader httpHeader)
          Returns HttpContent builder.
static HttpContent create()
           
static HttpContent create(HttpHeader httpHeader)
           
 Buffer getContent()
          Get the HTTP message content Buffer.
 HttpHeader getHttpHeader()
          Get the HTTP message header, associated with this content.
static boolean isBroken(HttpContent httpContent)
          Returns true if passed HttpContent is a BrokenHttpContent.
static boolean isContent(HttpPacket httpPacket)
          Returns true if passed HttpPacket is a HttpContent.
 boolean isHeader()
          Returns true, if this HTTP message represents HTTP message header, or false otherwise.
 boolean isLast()
          Return true, if the current content chunk is last, or false, if there are content chunks to follow.
 void recycle()
          
protected  void reset()
          Reset the internal state.
protected  void setContent(Buffer content)
           
 void setLast(boolean isLast)
           
 
Methods inherited from class org.glassfish.grizzly.http.HttpPacket
isHttp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isLast

protected boolean isLast

content

protected Buffer content

httpHeader

protected HttpHeader httpHeader
Constructor Detail

HttpContent

protected HttpContent()

HttpContent

protected HttpContent(HttpHeader httpHeader)
Method Detail

isContent

public static boolean isContent(HttpPacket httpPacket)
Returns true if passed HttpPacket is a HttpContent.

Parameters:
httpPacket -
Returns:
true if passed HttpPacket is a HttpContent.

isBroken

public static boolean isBroken(HttpContent httpContent)
Returns true if passed HttpContent is a BrokenHttpContent.

Parameters:
httpContent -
Returns:
true if passed HttpContent is a BrokenHttpContent.

create

public static HttpContent create()

create

public static HttpContent create(HttpHeader httpHeader)

builder

public static HttpContent.Builder builder(HttpHeader httpHeader)
Returns HttpContent builder.

Parameters:
httpHeader - related HTTP message header
Returns:
HttpContent.Builder.

getContent

public Buffer getContent()
Get the HTTP message content Buffer.

Returns:
Buffer.

setContent

protected final void setContent(Buffer content)

getHttpHeader

public final HttpHeader getHttpHeader()
Get the HTTP message header, associated with this content.

Returns:
HttpHeader.

isLast

public boolean isLast()
Return true, if the current content chunk is last, or false, if there are content chunks to follow.

Returns:
true, if the current content chunk is last, or false, if there are content chunks to follow.

setLast

public void setLast(boolean isLast)

isHeader

public final boolean isHeader()
Returns true, if this HTTP message represents HTTP message header, or false otherwise.

Specified by:
isHeader in class HttpPacket
Returns:
true, if this HTTP message represents HTTP message header, or false otherwise.

append

public HttpContent append(HttpContent element)
Specified by:
append in interface Appendable<HttpContent>

reset

protected void reset()
Reset the internal state.


recycle

public void recycle()

Specified by:
recycle in interface Cacheable


Copyright © 2013 Oracle Corporation. All Rights Reserved.