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

public final Class ChunkedTransferEncoding

extends Object
implements TransferEncoding
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.http.TransferEncoding
Static Imports
org.glassfish.grizzly.http.util.HttpCodecUtils.isSpaceOrTab, .HttpCodecUtils.put, .HttpCodecUtils.skipSpaces, org.glassfish.grizzly.utils.Charsets.ASCII_CHARSET

Chunked transfer encoding implementation.
Author
Alexey Stashok
See Also
TransferEncoding

Field Summary

Modifier and TypeField and Description
private static final int
private static final long
private static final int[]
private static final byte[]
private static final int
private final int
public static final String
private final boolean

Constructor Summary

AccessConstructor and Description
public
ChunkedTransferEncoding(final int maxHeadersSize)

public
ChunkedTransferEncoding(final int maxHeadersSize, final Properties props)

Method Summary

Modifier and TypeMethod and Description
private static boolean
checkOverflow(final long value)

Returns: false if next left bit-shift by 4 bits will cause overflow, or true otherwise

private static Buffer
encodeHttpChunk(final MemoryManager<E extends Buffer> memoryManager, final HttpContent httpContent, final boolean isLastChunk)

private void
private static boolean
isHeadRequest(final HttpHeader header)

private static boolean
parseHttpChunkLength(final HttpPacketParsing httpPacket, final Buffer input, final boolean strictLineTerminator)

private boolean
parseLastChunkTrailer(final FilterChainContext ctx, final HttpHeader httpHeader, final HttpPacketParsing httpPacket, final Buffer input)

public ParsingResult
parsePacket(final FilterChainContext ctx, final HttpHeader httpPacket, Buffer buffer)

Implements org.glassfish.grizzly.http.TransferEncoding.parsePacket.

Parse HTTP packet payload, represented by Buffer using specific transfer encoding.

private static Buffer
parseTrailerCRLF(final HttpPacketParsing httpPacket, final Buffer input)

public void
prepareSerialize(final FilterChainContext ctx, final HttpHeader httpHeader, final HttpContent content)

Implements org.glassfish.grizzly.http.TransferEncoding.prepareSerialize.

This method will be called by HttpCodecFilter to let TransferEncoding prepare itself for the content serialization.

public Buffer
serializePacket(final FilterChainContext ctx, final HttpContent httpContent)

Implements org.glassfish.grizzly.http.TransferEncoding.serializePacket.

Serialize HTTP packet payload, represented by HttpContent using specific transfer encoding.

public boolean
wantDecode(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.TransferEncoding.wantDecode.

Return true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.

public boolean
wantEncode(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.TransferEncoding.wantEncode.

Return true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHUNK_LENGTH_PARSED_STATEback to summary
private static final int CHUNK_LENGTH_PARSED_STATE
CHUNK_SIZE_OVERFLOWback to summary
private static final long CHUNK_SIZE_OVERFLOW
DECback to summary
private static final int[] DEC
LAST_CHUNK_CRLF_BYTESback to summary
private static final byte[] LAST_CHUNK_CRLF_BYTES
MAX_HTTP_CHUNK_SIZE_LENGTHback to summary
private static final int MAX_HTTP_CHUNK_SIZE_LENGTH
maxHeadersSizeback to summary
private final int maxHeadersSize
STRICT_CHUNKED_TRANSFER_CODING_LINE_TERMINATOR_RFC_9112back to summary
public static final String STRICT_CHUNKED_TRANSFER_CODING_LINE_TERMINATOR_RFC_9112
strictLineTerminatorback to summary
private final boolean strictLineTerminator

Constructor Detail

ChunkedTransferEncodingback to summary
public ChunkedTransferEncoding(final int maxHeadersSize)
ChunkedTransferEncodingback to summary
public ChunkedTransferEncoding(final int maxHeadersSize, final Properties props)

Method Detail

checkOverflowback to summary
private static boolean checkOverflow(final long value)
Returns:boolean

false if next left bit-shift by 4 bits will cause overflow, or true otherwise

encodeHttpChunkback to summary
private static Buffer encodeHttpChunk(final MemoryManager<E extends Buffer> memoryManager, final HttpContent httpContent, final boolean isLastChunk)
initTrailerParsingback to summary
private void initTrailerParsing(HttpPacketParsing httpPacket)
isHeadRequestback to summary
private static boolean isHeadRequest(final HttpHeader header)
parseHttpChunkLengthback to summary
private static boolean parseHttpChunkLength(final HttpPacketParsing httpPacket, final Buffer input, final boolean strictLineTerminator)
parseLastChunkTrailerback to summary
private boolean parseLastChunkTrailer(final FilterChainContext ctx, final HttpHeader httpHeader, final HttpPacketParsing httpPacket, final Buffer input)
parsePacketback to summary
public ParsingResult parsePacket(final FilterChainContext ctx, final HttpHeader httpPacket, Buffer buffer)

Implements org.glassfish.grizzly.http.TransferEncoding.parsePacket.

Doc from org.glassfish.grizzly.http.TransferEncoding.parsePacket.

Parse HTTP packet payload, represented by Buffer using specific transfer encoding.

Annotations
@Override
@SuppressWarnings:UnusedDeclaration
parseTrailerCRLFback to summary
private static Buffer parseTrailerCRLF(final HttpPacketParsing httpPacket, final Buffer input)
prepareSerializeback to summary
public void prepareSerialize(final FilterChainContext ctx, final HttpHeader httpHeader, final HttpContent content)

Implements org.glassfish.grizzly.http.TransferEncoding.prepareSerialize.

Doc from org.glassfish.grizzly.http.TransferEncoding.prepareSerialize.

This method will be called by HttpCodecFilter to let TransferEncoding prepare itself for the content serialization. At this time TransferEncoding is able to change, update HTTP packet headers.

Annotations
@Override
serializePacketback to summary
public Buffer serializePacket(final FilterChainContext ctx, final HttpContent httpContent)

Implements org.glassfish.grizzly.http.TransferEncoding.serializePacket.

Doc from org.glassfish.grizzly.http.TransferEncoding.serializePacket.

Serialize HTTP packet payload, represented by HttpContent using specific transfer encoding.

Annotations
@Override
wantDecodeback to summary
public boolean wantDecode(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.TransferEncoding.wantDecode.

Doc from org.glassfish.grizzly.http.TransferEncoding.wantDecode.

Return true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.

Annotations
@Override
wantEncodeback to summary
public boolean wantEncode(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.TransferEncoding.wantEncode.

Doc from org.glassfish.grizzly.http.TransferEncoding.wantEncode.

Return true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.

Annotations
@Override