Class SpdyFrameCodec

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler, SpdyFrameDecoderDelegate

    public class SpdyFrameCodec
    extends io.netty.handler.codec.ByteToMessageDecoder
    implements SpdyFrameDecoderDelegate, io.netty.channel.ChannelOutboundHandler
    A ChannelHandler that encodes and decodes SPDY Frames.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder

        io.netty.handler.codec.ByteToMessageDecoder.Cumulator
      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Field Summary

      • Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder

        COMPOSITE_CUMULATOR, MERGE_CUMULATOR
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        SpdyFrameCodec​(SpdyVersion version)
      Creates a new instance with the specified version, validateHeaders (true), and the default decoder and encoder options (maxChunkSize (8192), maxHeaderSize (16384), compressionLevel (6), windowBits (15), and memLevel (8)).
        SpdyFrameCodec​(SpdyVersion version, boolean validateHeaders)
      Creates a new instance with the specified version, validateHeaders, and the default decoder and encoder options (maxChunkSize (8192), maxHeaderSize (16384), compressionLevel (6), windowBits (15), and memLevel (8)).
        SpdyFrameCodec​(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel)
      Creates a new instance with the specified version, validateHeaders (true), decoder and encoder options.
        SpdyFrameCodec​(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel, boolean validateHeaders)
      Creates a new instance with the specified version, validateHeaders, decoder and encoder options.
      protected SpdyFrameCodec​(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)  
      void channelReadComplete​(io.netty.channel.ChannelHandlerContext ctx)  
      void close​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)  
      void connect​(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)  
      protected void decode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)  
      void deregister​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)  
      void disconnect​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)  
      void flush​(io.netty.channel.ChannelHandlerContext ctx)  
      void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)  
      void read​(io.netty.channel.ChannelHandlerContext ctx)  
      void readDataFrame​(int streamId, boolean last, io.netty.buffer.ByteBuf data)
      Called when a DATA frame is received.
      void readFrameError​(String message)
      Called when an unrecoverable session error has occurred.
      void readGoAwayFrame​(int lastGoodStreamId, int statusCode)
      Called when a GOAWAY frame is received.
      void readHeaderBlock​(io.netty.buffer.ByteBuf headerBlock)
      Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.
      void readHeaderBlockEnd()
      Called when an entire header block has been received.
      void readHeadersFrame​(int streamId, boolean last)
      Called when a HEADERS frame is received.
      void readPingFrame​(int id)
      Called when a PING frame is received.
      void readRstStreamFrame​(int streamId, int statusCode)
      Called when a RST_STREAM frame is received.
      void readSetting​(int id, int value, boolean persistValue, boolean persisted)
      Called when an individual setting within a SETTINGS frame is received.
      void readSettingsEnd()
      Called when the entire SETTINGS frame has been received.
      void readSettingsFrame​(boolean clearPersisted)
      Called when a SETTINGS frame is received.
      void readSynReplyFrame​(int streamId, boolean last)
      Called when a SYN_REPLY frame is received.
      void readSynStreamFrame​(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional)
      Called when a SYN_STREAM frame is received.
      void readWindowUpdateFrame​(int streamId, int deltaWindowSize)
      Called when a WINDOW_UPDATE frame is received.
      void write​(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)  
      • Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder

        actualReadableBytes, callDecode, channelInactive, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, isSharable
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerRemoved
    • Constructor Detail

      • SpdyFrameCodec

        public SpdyFrameCodec​(SpdyVersion version)
        Creates a new instance with the specified version, validateHeaders (true), and the default decoder and encoder options (maxChunkSize (8192), maxHeaderSize (16384), compressionLevel (6), windowBits (15), and memLevel (8)).
      • SpdyFrameCodec

        public SpdyFrameCodec​(SpdyVersion version,
                              boolean validateHeaders)
        Creates a new instance with the specified version, validateHeaders, and the default decoder and encoder options (maxChunkSize (8192), maxHeaderSize (16384), compressionLevel (6), windowBits (15), and memLevel (8)).
      • SpdyFrameCodec

        public SpdyFrameCodec​(SpdyVersion version,
                              int maxChunkSize,
                              int maxHeaderSize,
                              int compressionLevel,
                              int windowBits,
                              int memLevel)
        Creates a new instance with the specified version, validateHeaders (true), decoder and encoder options.
      • SpdyFrameCodec

        public SpdyFrameCodec​(SpdyVersion version,
                              int maxChunkSize,
                              int maxHeaderSize,
                              int compressionLevel,
                              int windowBits,
                              int memLevel,
                              boolean validateHeaders)
        Creates a new instance with the specified version, validateHeaders, decoder and encoder options.
    • Method Detail

      • handlerAdded

        public void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Overrides:
        handlerAdded in class io.netty.channel.ChannelHandlerAdapter
        Throws:
        Exception
      • decode

        protected void decode​(io.netty.channel.ChannelHandlerContext ctx,
                              io.netty.buffer.ByteBuf in,
                              List<Object> out)
                       throws Exception
        Specified by:
        decode in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • channelReadComplete

        public void channelReadComplete​(io.netty.channel.ChannelHandlerContext ctx)
                                 throws Exception
        Specified by:
        channelReadComplete in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelReadComplete in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • bind

        public void bind​(io.netty.channel.ChannelHandlerContext ctx,
                         SocketAddress localAddress,
                         io.netty.channel.ChannelPromise promise)
                  throws Exception
        Specified by:
        bind in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • connect

        public void connect​(io.netty.channel.ChannelHandlerContext ctx,
                            SocketAddress remoteAddress,
                            SocketAddress localAddress,
                            io.netty.channel.ChannelPromise promise)
                     throws Exception
        Specified by:
        connect in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • disconnect

        public void disconnect​(io.netty.channel.ChannelHandlerContext ctx,
                               io.netty.channel.ChannelPromise promise)
                        throws Exception
        Specified by:
        disconnect in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • close

        public void close​(io.netty.channel.ChannelHandlerContext ctx,
                          io.netty.channel.ChannelPromise promise)
                   throws Exception
        Specified by:
        close in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • deregister

        public void deregister​(io.netty.channel.ChannelHandlerContext ctx,
                               io.netty.channel.ChannelPromise promise)
                        throws Exception
        Specified by:
        deregister in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • read

        public void read​(io.netty.channel.ChannelHandlerContext ctx)
                  throws Exception
        Specified by:
        read in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • flush

        public void flush​(io.netty.channel.ChannelHandlerContext ctx)
                   throws Exception
        Specified by:
        flush in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • write

        public void write​(io.netty.channel.ChannelHandlerContext ctx,
                          Object msg,
                          io.netty.channel.ChannelPromise promise)
                   throws Exception
        Specified by:
        write in interface io.netty.channel.ChannelOutboundHandler
        Throws:
        Exception
      • readSynStreamFrame

        public void readSynStreamFrame​(int streamId,
                                       int associatedToStreamId,
                                       byte priority,
                                       boolean last,
                                       boolean unidirectional)
        Description copied from interface: SpdyFrameDecoderDelegate
        Called when a SYN_STREAM frame is received. The Name/Value Header Block is not included. See readHeaderBlock().
        Specified by:
        readSynStreamFrame in interface SpdyFrameDecoderDelegate
      • readSynReplyFrame

        public void readSynReplyFrame​(int streamId,
                                      boolean last)
        Description copied from interface: SpdyFrameDecoderDelegate
        Called when a SYN_REPLY frame is received. The Name/Value Header Block is not included. See readHeaderBlock().
        Specified by:
        readSynReplyFrame in interface SpdyFrameDecoderDelegate
      • readSetting

        public void readSetting​(int id,
                                int value,
                                boolean persistValue,
                                boolean persisted)
        Description copied from interface: SpdyFrameDecoderDelegate
        Called when an individual setting within a SETTINGS frame is received.
        Specified by:
        readSetting in interface SpdyFrameDecoderDelegate
      • readHeadersFrame

        public void readHeadersFrame​(int streamId,
                                     boolean last)
        Description copied from interface: SpdyFrameDecoderDelegate
        Called when a HEADERS frame is received. The Name/Value Header Block is not included. See readHeaderBlock().
        Specified by:
        readHeadersFrame in interface SpdyFrameDecoderDelegate