Class FixedLengthTransferEncoding

java.lang.Object
org.glassfish.grizzly.http.FixedLengthTransferEncoding
All Implemented Interfaces:
TransferEncoding

public final class FixedLengthTransferEncoding extends Object implements TransferEncoding
Fixed length transfer encoding implementation.
Author:
Alexey Stashok
See Also:
  • Constructor Details

    • FixedLengthTransferEncoding

      public FixedLengthTransferEncoding()
  • 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 httpContent)
      Description copied from interface: TransferEncoding
      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.
      httpContent - ready HTTP content (might be null).
    • parsePacket

      public ParsingResult parsePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.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 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