Interface Http2FrameWriter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      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
      io.netty.channel.ChannelFuture writeFrame​(io.netty.channel.ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, io.netty.buffer.ByteBuf payload, io.netty.channel.ChannelPromise promise)
      Generic write method for any HTTP/2 frame.
      io.netty.channel.ChannelFuture writeGoAway​(io.netty.channel.ChannelHandlerContext ctx, int lastStreamId, long errorCode, io.netty.buffer.ByteBuf debugData, io.netty.channel.ChannelPromise promise)
      Writes a GO_AWAY frame to the remote endpoint.
      io.netty.channel.ChannelFuture writeHeaders​(io.netty.channel.ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream, io.netty.channel.ChannelPromise promise)
      Writes a HEADERS frame to the remote endpoint.
      io.netty.channel.ChannelFuture writeHeaders​(io.netty.channel.ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream, io.netty.channel.ChannelPromise promise)
      Writes a HEADERS frame with priority specified to the remote endpoint.
      io.netty.channel.ChannelFuture writePing​(io.netty.channel.ChannelHandlerContext ctx, boolean ack, long data, io.netty.channel.ChannelPromise promise)
      Writes a PING frame to the remote endpoint.
      io.netty.channel.ChannelFuture writePriority​(io.netty.channel.ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive, io.netty.channel.ChannelPromise promise)
      Writes a PRIORITY frame to the remote endpoint.
      io.netty.channel.ChannelFuture writePushPromise​(io.netty.channel.ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding, io.netty.channel.ChannelPromise promise)
      Writes a PUSH_PROMISE frame to the remote endpoint.
      io.netty.channel.ChannelFuture writeRstStream​(io.netty.channel.ChannelHandlerContext ctx, int streamId, long errorCode, io.netty.channel.ChannelPromise promise)
      Writes a RST_STREAM frame to the remote endpoint.
      io.netty.channel.ChannelFuture writeSettings​(io.netty.channel.ChannelHandlerContext ctx, Http2Settings settings, io.netty.channel.ChannelPromise promise)
      Writes a SETTINGS frame to the remote endpoint.
      io.netty.channel.ChannelFuture writeSettingsAck​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
      Writes a SETTINGS acknowledgment to the remote endpoint.
      io.netty.channel.ChannelFuture writeWindowUpdate​(io.netty.channel.ChannelHandlerContext ctx, int streamId, int windowSizeIncrement, io.netty.channel.ChannelPromise promise)
      Writes a WINDOW_UPDATE frame to the remote endpoint.
    • Method Detail

      • writeHeaders

        io.netty.channel.ChannelFuture writeHeaders​(io.netty.channel.ChannelHandlerContext ctx,
                                                    int streamId,
                                                    Http2Headers headers,
                                                    int padding,
                                                    boolean endStream,
                                                    io.netty.channel.ChannelPromise promise)
        Writes a HEADERS frame to the remote endpoint.
        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

        io.netty.channel.ChannelFuture writeHeaders​(io.netty.channel.ChannelHandlerContext ctx,
                                                    int streamId,
                                                    Http2Headers headers,
                                                    int streamDependency,
                                                    short weight,
                                                    boolean exclusive,
                                                    int padding,
                                                    boolean endStream,
                                                    io.netty.channel.ChannelPromise promise)
        Writes a HEADERS frame with priority specified to the remote endpoint.
        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).
        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.

      • writePriority

        io.netty.channel.ChannelFuture writePriority​(io.netty.channel.ChannelHandlerContext ctx,
                                                     int streamId,
                                                     int streamDependency,
                                                     short weight,
                                                     boolean exclusive,
                                                     io.netty.channel.ChannelPromise promise)
        Writes a PRIORITY frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        streamId - the stream for which to send the frame.
        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.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writeRstStream

        io.netty.channel.ChannelFuture writeRstStream​(io.netty.channel.ChannelHandlerContext ctx,
                                                      int streamId,
                                                      long errorCode,
                                                      io.netty.channel.ChannelPromise promise)
        Writes a RST_STREAM frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        streamId - the stream for which to send the frame.
        errorCode - the error code indicating the nature of the failure.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writeSettings

        io.netty.channel.ChannelFuture writeSettings​(io.netty.channel.ChannelHandlerContext ctx,
                                                     Http2Settings settings,
                                                     io.netty.channel.ChannelPromise promise)
        Writes a SETTINGS frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        settings - the settings to be sent.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writeSettingsAck

        io.netty.channel.ChannelFuture writeSettingsAck​(io.netty.channel.ChannelHandlerContext ctx,
                                                        io.netty.channel.ChannelPromise promise)
        Writes a SETTINGS acknowledgment to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writePing

        io.netty.channel.ChannelFuture writePing​(io.netty.channel.ChannelHandlerContext ctx,
                                                 boolean ack,
                                                 long data,
                                                 io.netty.channel.ChannelPromise promise)
        Writes a PING frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        ack - indicates whether this is an ack of a PING frame previously received from the remote endpoint.
        data - the payload of the frame.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writePushPromise

        io.netty.channel.ChannelFuture writePushPromise​(io.netty.channel.ChannelHandlerContext ctx,
                                                        int streamId,
                                                        int promisedStreamId,
                                                        Http2Headers headers,
                                                        int padding,
                                                        io.netty.channel.ChannelPromise promise)
        Writes a PUSH_PROMISE frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        streamId - the stream for which to send the frame.
        promisedStreamId - the ID of the promised stream.
        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).
        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.

      • writeGoAway

        io.netty.channel.ChannelFuture writeGoAway​(io.netty.channel.ChannelHandlerContext ctx,
                                                   int lastStreamId,
                                                   long errorCode,
                                                   io.netty.buffer.ByteBuf debugData,
                                                   io.netty.channel.ChannelPromise promise)
        Writes a GO_AWAY frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        lastStreamId - the last known stream of this endpoint.
        errorCode - the error code, if the connection was abnormally terminated.
        debugData - application-defined debug data. This will be released by this method.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writeWindowUpdate

        io.netty.channel.ChannelFuture writeWindowUpdate​(io.netty.channel.ChannelHandlerContext ctx,
                                                         int streamId,
                                                         int windowSizeIncrement,
                                                         io.netty.channel.ChannelPromise promise)
        Writes a WINDOW_UPDATE frame to the remote endpoint.
        Parameters:
        ctx - the context to use for writing.
        streamId - the stream for which to send the frame.
        windowSizeIncrement - the number of bytes by which the local inbound flow control window is increasing.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • writeFrame

        io.netty.channel.ChannelFuture writeFrame​(io.netty.channel.ChannelHandlerContext ctx,
                                                  byte frameType,
                                                  int streamId,
                                                  Http2Flags flags,
                                                  io.netty.buffer.ByteBuf payload,
                                                  io.netty.channel.ChannelPromise promise)
        Generic write method for any HTTP/2 frame. This allows writing of non-standard frames.
        Parameters:
        ctx - the context to use for writing.
        frameType - the frame type identifier.
        streamId - the stream for which to send the frame.
        flags - the flags to write for this frame.
        payload - the payload to write for this frame. This will be released by this method.
        promise - the promise for the write.
        Returns:
        the future for the write.
      • close

        void close()
        Closes this writer and frees any allocated resources.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable