Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http

public Class HttpContent

extends HttpPacket
implements Appendable<HttpContent>
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.Appendable
Known Direct Subclasses
org.glassfish.grizzly.http.HttpTrailer, org.glassfish.grizzly.http.HttpBrokenContent
Imports
org.glassfish.grizzly.Buffer, .ThreadCache, org.glassfish.grizzly.memory.Buffers

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 HttpContent#getHttpHeader(). To build HttpContent message, use Builder object, which could be get following way: HttpContent#builder(org.glassfish.grizzly.http.HttpHeader).
Author
Alexey Stashok
See Also
HttpPacket, HttpHeader

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HttpContent.Builder<T extends HttpContent.Builder>

HttpContent message builder.

Field Summary

Modifier and TypeField and Description
private static final ThreadCache.CachedTypeIndex<HttpContent>
protected Buffer
protected HttpHeader
protected boolean

Constructor Summary

AccessConstructor and Description
protected
protected
HttpContent(final HttpHeader httpHeader)

protected
HttpContent(final HttpHeader httpHeader, final boolean isLast, final Buffer content)

Method Summary

Modifier and TypeMethod and Description
public HttpContent
public static HttpContent.Builder<T extends HttpContent.Builder>

Returns:

Builder.
builder
(final HttpHeader
related HTTP message header
httpHeader
)

Returns HttpContent builder.

public static HttpContent
public static HttpContent
create(final HttpHeader httpHeader)

public static HttpContent
create(final HttpHeader httpHeader, final boolean isLast)

public static HttpContent
create(final HttpHeader httpHeader, final boolean isLast, Buffer content)

public Buffer

Returns:

Buffer.
getContent
()

Get the HTTP message content Buffer.

public final HttpHeader

Returns:

HttpHeader.
getHttpHeader
()

Implements abstract org.glassfish.grizzly.http.HttpPacket.getHttpHeader.

Get the HTTP message header, associated with this content.

public static boolean

Returns:

true if passed HttpContent is a BrokenHttpContent.
isBroken
(final HttpContent httpContent)

Returns true if passed HttpContent is a BrokenHttpContent.

public static boolean

Returns:

true if passed HttpPacket is a HttpContent.
isContent
(final HttpPacket httpPacket)

Returns true if passed HttpPacket is a HttpContent.

public final boolean
isHeader()

Implements abstract org.glassfish.grizzly.http.HttpPacket.isHeader.

Returns true, if this HTTP message represents HTTP message header, or false otherwise.

public boolean
isLast()

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

public void
protected void
reset()

Reset the internal state.

protected final void
setContent(Buffer content)

public void
setLast(boolean isLast)

Inherited from org.glassfish.grizzly.http.HttpPacket:
isHttp

Field Detail

CACHE_IDXback to summary
private static final ThreadCache.CachedTypeIndex<HttpContent> CACHE_IDX
contentback to summary
protected Buffer content
httpHeaderback to summary
protected HttpHeader httpHeader
isLastback to summary
protected boolean isLast

Constructor Detail

HttpContentback to summary
protected HttpContent()
HttpContentback to summary
protected HttpContent(final HttpHeader httpHeader)
HttpContentback to summary
protected HttpContent(final HttpHeader httpHeader, final boolean isLast, final Buffer content)

Method Detail

appendback to summary
public HttpContent append(final HttpContent element)

Implements org.glassfish.grizzly.Appendable.append.

Annotations
@Override
builderback to summary
public static HttpContent.Builder<T extends HttpContent.Builder> builder(final HttpHeader httpHeader)

Returns HttpContent builder.

Parameters
httpHeader:HttpHeader

related HTTP message header

Returns:HttpContent.Builder<T extends HttpContent.Builder>

Builder.

createback to summary
public static HttpContent create()
createback to summary
public static HttpContent create(final HttpHeader httpHeader)
createback to summary
public static HttpContent create(final HttpHeader httpHeader, final boolean isLast)
createback to summary
public static HttpContent create(final HttpHeader httpHeader, final boolean isLast, Buffer content)
getContentback to summary
public Buffer getContent()

Get the HTTP message content Buffer.

Returns:Buffer

Buffer.

getHttpHeaderback to summary
public final HttpHeader getHttpHeader()

Implements abstract org.glassfish.grizzly.http.HttpPacket.getHttpHeader.

Get the HTTP message header, associated with this content.

Returns:HttpHeader

HttpHeader.

Annotations
@Override
isBrokenback to summary
public static boolean isBroken(final HttpContent httpContent)

Returns true if passed HttpContent is a BrokenHttpContent.

Returns:boolean

true if passed HttpContent is a BrokenHttpContent.

isContentback to summary
public static boolean isContent(final HttpPacket httpPacket)

Returns true if passed HttpPacket is a HttpContent.

Returns:boolean

true if passed HttpPacket is a HttpContent.

isHeaderback to summary
public final boolean isHeader()

Implements abstract org.glassfish.grizzly.http.HttpPacket.isHeader.

Doc from org.glassfish.grizzly.http.HttpPacket.isHeader.

Returns true, if this HTTP message represents HTTP message header, or false otherwise.

Annotations
@Override
isLastback to summary
public boolean isLast()
Returns:boolean

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

recycleback to summary
public void recycle()

Implements org.glassfish.grizzly.Cacheable.recycle.

Annotations
@Override
resetback to summary
protected void reset()

Reset the internal state.

setContentback to summary
protected final void setContent(Buffer content)
setLastback to summary
public void setLast(boolean isLast)
org.glassfish.grizzly.http back to summary

public Class HttpContent.Builder<T extends HttpContent.Builder>

extends Object
Class Inheritance
Known Direct Subclasses
org.glassfish.grizzly.http.HttpTrailer.Builder, org.glassfish.grizzly.http.HttpBrokenContent.Builder

HttpContent message builder.

Field Summary

Modifier and TypeField and Description
protected Buffer
protected HttpHeader
protected boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public HttpContent

Returns:

HttpContent
build
()

Build the HttpContent message.

public final T

Returns:

Builder
content
(Buffer
the HttpContent chunk content Buffer.
content
)

Set the HttpContent chunk content Buffer.

protected HttpContent
public final T

Returns:

this.
httpHeader
(final HttpHeader
the HttpHeader associated with this content.
httpHeader
)

Set the HttpHeader associated with this content.

public final T

Returns:

Builder
last
(boolean
is this HttpContent chunk last.
last
)

Set whether this HttpContent chunk is the last.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentback to summary
protected Buffer content
httpHeaderback to summary
protected HttpHeader httpHeader
lastback to summary
protected boolean last

Constructor Detail

Builderback to summary
protected Builder()

Method Detail

buildback to summary
public HttpContent build()

Build the HttpContent message.

Returns:HttpContent

HttpContent

contentback to summary
public final T content(Buffer content)

Set the HttpContent chunk content Buffer.

Parameters
content:Buffer

the HttpContent chunk content Buffer.

Returns:T

Builder

Annotations
@SuppressWarnings:unchecked
createback to summary
protected HttpContent create()
httpHeaderback to summary
public final T httpHeader(final HttpHeader httpHeader)

Set the HttpHeader associated with this content.

Parameters
httpHeader:HttpHeader

the HttpHeader associated with this content.

Returns:T

this.

Annotations
@SuppressWarnings:unchecked
lastback to summary
public final T last(boolean last)

Set whether this HttpContent chunk is the last.

Parameters
last:boolean

is this HttpContent chunk last.

Returns:T

Builder

Annotations
@SuppressWarnings:unchecked
resetback to summary
public void reset()