Class ChunkedTransferEncoding

java.lang.Object
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:
  • Constructor Details

    • ChunkedTransferEncoding

      public ChunkedTransferEncoding(int maxHeadersSize)
  • Method Details

    • 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(org.glassfish.grizzly.filterchain.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(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.Buffer buffer)
      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.
      buffer - Buffer HTTP message payload.
      Returns:
      ParsingResult
    • serializePacket

      public org.glassfish.grizzly.Buffer serializePacket(org.glassfish.grizzly.filterchain.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