Class PerMessageDeflateExtension

All Implemented Interfaces:
Closeable, AutoCloseable, Extension, IncomingFrames, DemandChain, OutgoingFrames

public class PerMessageDeflateExtension extends AbstractExtension implements DemandChain
Per Message Deflate Compression extension for WebSocket.

Attempts to follow Compression Extensions for WebSocket

  • Constructor Details

    • PerMessageDeflateExtension

      public PerMessageDeflateExtension()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Extension
      The Sec-WebSocket-Extensions name for this extension.

      Also known as the extension-token per Section 9.1. Negotiating Extensions.

      Specified by:
      getName in interface Extension
      getName in class AbstractExtension
      the name of the extension
    • isRsv1User

      public boolean isRsv1User()
      Description copied from class: AbstractExtension
      Used to indicate that the extension makes use of the RSV1 bit of the base websocket framing.

      This is used to adjust validation during parsing, as well as a checkpoint against 2 or more extensions all simultaneously claiming ownership of RSV1.

      Specified by:
      isRsv1User in interface Extension
      isRsv1User in class AbstractExtension
      true if extension uses RSV1 for its own purposes.
    • sendFrame

      public void sendFrame(Frame frame, Callback callback, boolean batch)
      Description copied from interface: OutgoingFrames
      A frame, and optional callback, intended for the network layer.

      Note: the frame can undergo many transformations in the various layers and extensions present in the implementation.

      If you are implementing a mutation, you are obliged to handle the incoming WriteCallback appropriately.

      Specified by:
      sendFrame in interface OutgoingFrames
      sendFrame in class AbstractExtension
      frame - the frame to eventually write to the network layer.
      callback - the callback to notify when the frame is written.
      batch - the batch mode requested by the sender.
    • onFrame

      public void onFrame(Frame frame, Callback callback)
      Description copied from interface: IncomingFrames

      Process the incoming frame.

      Note: if you need to hang onto any information from the frame, be sure to copy it, as the information contained in the Frame will be released and/or reused by the implementation.

      Failure of the callback will propagate the failure back to the CoreSession to fail the connection and attempt to send a close Frame if one has not been sent.

      Specified by:
      onFrame in interface IncomingFrames
      onFrame in class AbstractExtension
      frame - the frame to process.
      callback - the read completion.
    • init

      public void init(ExtensionConfig config, WebSocketComponents components)
      Specified by:
      init in interface Extension
      init in class AbstractExtension
    • close

      public void close()
      Description copied from interface: Extension
      Used to clean up any resources after connection close.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Extension
    • endsWithTail

      public static boolean endsWithTail(ByteBuffer buf)
    • getDeflater

      public Deflater getDeflater()
    • getInflater

      public Inflater getInflater()
    • releaseInflater

      public void releaseInflater()
    • releaseDeflater

      public void releaseDeflater()
    • toString

      public String toString()
      toString in class AbstractExtension
    • nextIncomingFrame

      protected void nextIncomingFrame(Frame frame, Callback callback)
      nextIncomingFrame in class AbstractExtension
    • nextOutgoingFrame

      protected void nextOutgoingFrame(Frame frame, Callback callback, boolean batch)
      nextOutgoingFrame in class AbstractExtension
    • setNextDemand

      public void setNextDemand(LongConsumer nextDemand)
      Specified by:
      setNextDemand in interface DemandChain
    • demand

      public void demand(long n)
      Specified by:
      demand in interface DemandChain