Interface TransferEncoding

All Known Implementing Classes:
ChunkedTransferEncoding, FixedLengthTransferEncoding

public interface TransferEncoding
Abstraction, which represents HTTP transfer-encoding. The implementation should take care about possible HTTP content fragmentation.
Author:
Alexey Stashok
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    org.glassfish.grizzly.Buffer
    serializePacket(org.glassfish.grizzly.filterchain.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.
  • Method Details

    • wantDecode

      boolean wantDecode(HttpHeader httpPacket)
      Return true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.
      Parameters:
      httpPacket - HttpHeader.
      Returns:
      true if this encoding should be used to parse the content of the passed HttpHeader, or false otherwise.
    • wantEncode

      boolean wantEncode(HttpHeader httpPacket)
      Return true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.
      Parameters:
      httpPacket - HttpHeader.
      Returns:
      true if this encoding should be used to serialize the content of the passed HttpHeader, or false otherwise.
    • prepareSerialize

      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.
      Parameters:
      ctx - FilterChainContext
      httpHeader - HTTP packet headers.
      content - ready HTTP content (might be null).
    • parsePacket

      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.
      Parameters:
      ctx - FilterChainContext
      httpPacket - HttpHeader with parsed headers.
      buffer - Buffer HTTP message payload.
      Returns:
      ParsingResult
    • serializePacket

      org.glassfish.grizzly.Buffer serializePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpContent httpContent)
      Serialize HTTP packet payload, represented by HttpContent using specific transfer encoding.
      Parameters:
      ctx - FilterChainContext
      httpContent - HttpContent with parsed HttpContent.getHttpHeader().
      Returns:
      serialized Buffer