GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Deprecated
  • Index
  • Search
  • Help
  • io.netty.handler.codec.http2
  • CompressorHttp2ConnectionEncoder

This view

  • Original page
  • New address

GeezerVison is showing netty.io — CompressorHttp2ConnectionEncoder (Netty API Reference (4.1.141.Final))

Class CompressorHttp2ConnectionEncoder

java.lang.Object
io.netty.handler.codec.http2.DecoratingHttp2FrameWriter
io.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder
io.netty.handler.codec.http2.CompressorHttp2ConnectionEncoder
All Implemented Interfaces:
Http2ConnectionEncoder, Http2DataWriter, Http2FrameWriter, Http2SettingsReceivedConsumer, Closeable, AutoCloseable

public class CompressorHttp2ConnectionEncoder extends DecoratingHttp2ConnectionEncoder
A decorating HTTP2 encoder that will compress data frames according to the content-encoding header for each stream. The compression provided by this class will be applied to the data for the entire stream.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface Http2FrameWriter

    Http2FrameWriter.Configuration
    Modifier and Type
    Interface
    Description
    static interface 
    Http2FrameWriter.Configuration
    Configuration specific to Http2FrameWriter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    DEFAULT_COMPRESSION_LEVEL
     
    static final int
    DEFAULT_MEM_LEVEL
     
    static final int
    DEFAULT_WINDOW_BITS
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate)
    Create a new CompressorHttp2ConnectionEncoder instance with default implementation of StandardCompressionOptions
    CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate, int compressionLevel, int windowBits, int memLevel)
    Deprecated.
    CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate, CompressionOptions... compressionOptionsArgs)
    Create a new CompressorHttp2ConnectionEncoder with specified StandardCompressionOptions
  • Method Summary

    Modifier and Type
    Method
    Description
    protected CharSequence
    getTargetContentEncoding(CharSequence contentEncoding)
    Returns the expected content encoding of the decoded content.
    protected EmbeddedChannel
    newContentCompressor(ChannelHandlerContext ctx, CharSequence contentEncoding)
    Returns a new EmbeddedChannel that encodes the HTTP2 message content encoded in the specified contentEncoding.
    ChannelFuture
    writeData(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream, ChannelPromise promise)
    Writes a DATA frame to the remote endpoint.
    ChannelFuture
    writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream, ChannelPromise promise)
    Writes a HEADERS frame to the remote endpoint.
    ChannelFuture
    writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream, ChannelPromise promise)
    Writes a HEADERS frame with priority specified to the remote endpoint.

    Methods inherited from class DecoratingHttp2ConnectionEncoder

    connection, consumeReceivedSettings, flowController, frameWriter, lifecycleManager, pollSentSettings, remoteSettings
    Modifier and Type
    Method
    Description
    Http2Connection
    connection()
    Provides direct access to the underlying connection.
    void
    consumeReceivedSettings(Http2Settings settings)
    Consume the most recently received but not yet ACKed settings.
    Http2RemoteFlowController
    flowController()
    Provides the remote flow controller for managing outbound traffic.
    Http2FrameWriter
    frameWriter()
    Provides direct access to the underlying frame writer object.
    void
    lifecycleManager(Http2LifecycleManager lifecycleManager)
    Sets the lifecycle manager.
    Http2Settings
    pollSentSettings()
    Gets the local settings on the top of the queue that has been sent but not ACKed.
    void
    remoteSettings(Http2Settings settings)
    Sets the settings for the remote endpoint of the HTTP/2 connection.

    Methods inherited from class DecoratingHttp2FrameWriter

    close, configuration, writeFrame, writeGoAway, writePing, writePriority, writePushPromise, writeRstStream, writeSettings, writeSettingsAck, writeWindowUpdate
    Modifier and Type
    Method
    Description
    void
    close()
    Closes this writer and frees any allocated resources.
    Http2FrameWriter.Configuration
    configuration()
    Get the configuration related elements for this Http2FrameWriter
    ChannelFuture
    writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, ByteBuf payload, ChannelPromise promise)
    Generic write method for any HTTP/2 frame.
    ChannelFuture
    writeGoAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData, ChannelPromise promise)
    Writes a GO_AWAY frame to the remote endpoint.
    ChannelFuture
    writePing(ChannelHandlerContext ctx, boolean ack, long data, ChannelPromise promise)
    Writes a PING frame to the remote endpoint.
    ChannelFuture
    writePriority(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive, ChannelPromise promise)
    Writes a PRIORITY frame to the remote endpoint.
    ChannelFuture
    writePushPromise(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding, ChannelPromise promise)
    Writes a PUSH_PROMISE frame to the remote endpoint.
    ChannelFuture
    writeRstStream(ChannelHandlerContext ctx, int streamId, long errorCode, ChannelPromise promise)
    Writes a RST_STREAM frame to the remote endpoint.
    ChannelFuture
    writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise)
    Writes a SETTINGS frame to the remote endpoint.
    ChannelFuture
    writeSettingsAck(ChannelHandlerContext ctx, ChannelPromise promise)
    Writes a SETTINGS acknowledgment to the remote endpoint.
    ChannelFuture
    writeWindowUpdate(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement, ChannelPromise promise)
    Writes a WINDOW_UPDATE frame to the remote endpoint.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface Http2ConnectionEncoder

    writeFrame
    Modifier and Type
    Method
    Description
    ChannelFuture
    writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, ByteBuf payload, ChannelPromise promise)
    Writes the given data to the internal Http2FrameWriter without performing any state checks on the connection/stream.
  • Field Details

    • DEFAULT_COMPRESSION_LEVEL

      public static final int DEFAULT_COMPRESSION_LEVEL
      See Also:
      • Constant Field Values
    • DEFAULT_WINDOW_BITS

      public static final int DEFAULT_WINDOW_BITS
      See Also:
      • Constant Field Values
    • DEFAULT_MEM_LEVEL

      public static final int DEFAULT_MEM_LEVEL
      See Also:
      • Constant Field Values
  • Constructor Details

    • CompressorHttp2ConnectionEncoder

      public CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate)
      Create a new CompressorHttp2ConnectionEncoder instance with default implementation of StandardCompressionOptions
    • CompressorHttp2ConnectionEncoder

      @Deprecated public CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate, int compressionLevel, int windowBits, int memLevel)
      Deprecated.
      Create a new CompressorHttp2ConnectionEncoder instance
    • CompressorHttp2ConnectionEncoder

      public CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate, CompressionOptions... compressionOptionsArgs)
      Create a new CompressorHttp2ConnectionEncoder with specified StandardCompressionOptions
  • Method Details

    • writeData

      public ChannelFuture writeData(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream, ChannelPromise promise)
      Description copied from interface: Http2DataWriter
      Writes a DATA frame to the remote endpoint. This will result in one or more frames being written to the context.
      Specified by:
      writeData in interface Http2DataWriter
      Overrides:
      writeData in class DecoratingHttp2FrameWriter
      Parameters:
      ctx - the context to use for writing.
      streamId - the stream for which to send the frame.
      data - the payload of the frame. This will be released by this method.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive). A 1 byte padding is encoded as just the pad length field with value 0. A 256 byte padding is encoded as the pad length field with value 255 and 255 padding bytes appended to the end of the frame.
      endOfStream - indicates if this is the last frame to be sent for the stream.
      promise - the promise for the write.
      Returns:
      the future for the write.
    • writeHeaders

      public ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream, ChannelPromise promise)
      Description copied from interface: Http2FrameWriter
      Writes a HEADERS frame to the remote endpoint.
      Specified by:
      writeHeaders in interface Http2FrameWriter
      Overrides:
      writeHeaders in class DecoratingHttp2FrameWriter
      Parameters:
      ctx - the context to use for writing.
      streamId - the stream for which to send the frame.
      headers - the headers to be sent.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
      endStream - indicates if this is the last frame to be sent for the stream.
      promise - the promise for the write.
      Returns:
      the future for the write. Section 10.5.1 states the following:
      The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
      
      If this call has modified the HPACK header state you MUST throw a connection error.

      If this call has NOT modified the HPACK header state you are free to throw a stream error.

    • writeHeaders

      public ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream, ChannelPromise promise)
      Description copied from interface: Http2FrameWriter
      Writes a HEADERS frame with priority specified to the remote endpoint.
      Specified by:
      writeHeaders in interface Http2FrameWriter
      Overrides:
      writeHeaders in class DecoratingHttp2FrameWriter
      Parameters:
      ctx - the context to use for writing.
      streamId - the stream for which to send the frame.
      headers - the headers to be sent.
      streamDependency - the stream on which this stream should depend, or 0 if it should depend on the connection.
      weight - the weight for this stream.
      exclusive - whether this stream should be the exclusive dependant of its parent.
      padding - additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
      endOfStream - indicates if this is the last frame to be sent for the stream.
      promise - the promise for the write.
      Returns:
      the future for the write. Section 10.5.1 states the following:
      The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
      
      If this call has modified the HPACK header state you MUST throw a connection error.

      If this call has NOT modified the HPACK header state you are free to throw a stream error.

    • newContentCompressor

      protected EmbeddedChannel newContentCompressor(ChannelHandlerContext ctx, CharSequence contentEncoding) throws Http2Exception
      Returns a new EmbeddedChannel that encodes the HTTP2 message content encoded in the specified contentEncoding.
      Parameters:
      ctx - the context.
      contentEncoding - the value of the content-encoding header
      Returns:
      a new ByteToMessageDecoder if the specified encoding is supported. null otherwise (alternatively, you can throw a Http2Exception to block unknown encoding).
      Throws:
      Http2Exception - If the specified encoding is not supported and warrants an exception
    • getTargetContentEncoding

      protected CharSequence getTargetContentEncoding(CharSequence contentEncoding) throws Http2Exception
      Returns the expected content encoding of the decoded content. Returning contentEncoding is the default behavior, which is the case for most compressors.
      Parameters:
      contentEncoding - the value of the content-encoding header
      Returns:
      the expected content encoding of the new content.
      Throws:
      Http2Exception - if the contentEncoding is not supported and warrants an exception
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.