Package org.glassfish.grizzly.http
Class HttpContent
java.lang.Object
org.glassfish.grizzly.http.HttpPacket
org.glassfish.grizzly.http.HttpContent
- All Implemented Interfaces:
Appendable<HttpContent>,Cacheable
- Direct Known Subclasses:
HttpBrokenContent,HttpTrailer
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHttpContent.Builder<T extends HttpContent.Builder>HttpContent message builder. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedHttpContent(HttpHeader httpHeader) protectedHttpContent(HttpHeader httpHeader, boolean isLast, Buffer content) -
Method Summary
Modifier and TypeMethodDescriptionappend(HttpContent element) static HttpContent.Builderbuilder(HttpHeader httpHeader) ReturnsHttpContentbuilder.static HttpContentcreate()static HttpContentcreate(HttpHeader httpHeader) static HttpContentcreate(HttpHeader httpHeader, boolean isLast) static HttpContentcreate(HttpHeader httpHeader, boolean isLast, Buffer content) Get the HTTP message contentBuffer.final HttpHeaderGet the HTTP message header, associated with this content.static booleanisBroken(HttpContent httpContent) Returns true if passedHttpContentis a BrokenHttpContent.static booleanisContent(HttpPacket httpPacket) Returns true if passedHttpPacketis a HttpContent.final booleanisHeader()Returns true, if this HTTP message represents HTTP message header, or false otherwise.booleanisLast()voidrecycle()protected voidreset()Reset the internal state.protected final voidsetContent(Buffer content) voidsetLast(boolean isLast) Methods inherited from class org.glassfish.grizzly.http.HttpPacket
isHttp
-
Field Details
-
isLast
protected boolean isLast -
-
httpHeader
-
-
Constructor Details
-
HttpContent
protected HttpContent() -
HttpContent
-
HttpContent
-
-
Method Details
-
isContent
Returns true if passedHttpPacketis a HttpContent.- Parameters:
httpPacket-- Returns:
- true if passed
HttpPacketis a HttpContent.
-
isBroken
Returns true if passedHttpContentis a BrokenHttpContent.- Parameters:
httpContent-- Returns:
- true if passed
HttpContentis a BrokenHttpContent.
-
create
-
create
-
create
-
create
-
builder
ReturnsHttpContentbuilder.- Parameters:
httpHeader- related HTTP message header- Returns:
HttpContent.Builder.
-
getContent
Get the HTTP message contentBuffer.- Returns:
Buffer.
-
setContent
-
getHttpHeader
Get the HTTP message header, associated with this content.- Specified by:
getHttpHeaderin classHttpPacket- Returns:
HttpHeader.
-
isLast
public boolean isLast()- 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:
isHeaderin classHttpPacket- Returns:
- true, if this HTTP message represents HTTP message header, or false otherwise.
-
append
- Specified by:
appendin interfaceAppendable<HttpContent>
-
reset
protected void reset()Reset the internal state. -
recycle
public void recycle()
-