org.glassfish.grizzly.http
Class ChunkedTransferEncoding

java.lang.Object
  extended by org.glassfish.grizzly.http.ChunkedTransferEncoding
All Implemented Interfaces:
TransferEncoding

public final class ChunkedTransferEncoding
extends Object
implements TransferEncoding

Chunked transfer encoding implementation.

Author:
Alexey Stashok
See Also:
TransferEncoding

Constructor Summary
ChunkedTransferEncoding(int maxHeadersSize)
           
 
Method Summary
 ParsingResult parsePacket(FilterChainContext ctx, HttpHeader httpPacket, Buffer input)
          Parse HTTP packet payload, represented by Buffer using specific transfer encoding.
 void prepareSerialize(FilterChainContext ctx, HttpHeader httpHeader, HttpContent content)
          This method will be called by HttpCodecFilter to let TransferEncoding prepare itself for the content serialization.
 Buffer serializePacket(FilterChainContext ctx, HttpContent httpContent)
          Serialize HTTP packet payload, represented by HttpContent using specific transfer encoding.
 boolean wantDecode(HttpHeader httpPacket)
          Return true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.
 boolean wantEncode(HttpHeader httpPacket)
          Return true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkedTransferEncoding

public ChunkedTransferEncoding(int maxHeadersSize)
Method Detail

wantDecode

public boolean wantDecode(HttpHeader httpPacket)
Return true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.

Specified by:
wantDecode in interface TransferEncoding
Parameters:
httpPacket - HttpHeader.
Returns:
true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.

wantEncode

public boolean wantEncode(HttpHeader httpPacket)
Return true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.

Specified by:
wantEncode in interface TransferEncoding
Parameters:
httpPacket - HttpHeader.
Returns:
true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.

prepareSerialize

public void prepareSerialize(FilterChainContext ctx,
                             HttpHeader httpHeader,
                             HttpContent content)
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.

Specified by:
prepareSerialize in interface TransferEncoding
Parameters:
ctx - FilterChainContext
httpHeader - HTTP packet headers.
content - ready HTTP content (might be null).

parsePacket

public ParsingResult parsePacket(FilterChainContext ctx,
                                 HttpHeader httpPacket,
                                 Buffer input)
Parse HTTP packet payload, represented by Buffer using specific transfer encoding.

Specified by:
parsePacket in interface TransferEncoding
Parameters:
ctx - FilterChainContext
httpPacket - HttpHeader with parsed headers.
input - Buffer HTTP message payload.
Returns:
ParsingResult

serializePacket

public Buffer serializePacket(FilterChainContext ctx,
                              HttpContent httpContent)
Serialize HTTP packet payload, represented by HttpContent using specific transfer encoding.

Specified by:
serializePacket in interface TransferEncoding
Parameters:
ctx - FilterChainContext
httpContent - HttpContent with parsed HttpContent.getHttpHeader().
Returns:
serialized Buffer


Copyright © 2013 Oracle Corporation. All Rights Reserved.