Package io.netty.handler.codec.spdy
Class SpdyFrameCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.codec.spdy.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
AChannelHandler
that encodes and decodes SPDY Frames.
-
-
Constructor Summary
Constructors Modifier Constructor Description SpdyFrameCodec(SpdyVersion version)
Creates a new instance with the specifiedversion
,validateHeaders (true)
, and the default decoder and encoder options (maxChunkSize (8192)
,maxHeaderSize (16384)
,compressionLevel (6)
,windowBits (15)
, andmemLevel (8)
).SpdyFrameCodec(SpdyVersion version, boolean validateHeaders)
Creates a new instance with the specifiedversion
,validateHeaders
, and the default decoder and encoder options (maxChunkSize (8192)
,maxHeaderSize (16384)
,compressionLevel (6)
,windowBits (15)
, andmemLevel (8)
).SpdyFrameCodec(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel)
Creates a new instance with the specifiedversion
,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 specifiedversion
,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
-
-
-
-
Constructor Detail
-
SpdyFrameCodec
public SpdyFrameCodec(SpdyVersion version)
Creates a new instance with the specifiedversion
,validateHeaders (true)
, and the default decoder and encoder options (maxChunkSize (8192)
,maxHeaderSize (16384)
,compressionLevel (6)
,windowBits (15)
, andmemLevel (8)
).
-
SpdyFrameCodec
public SpdyFrameCodec(SpdyVersion version, boolean validateHeaders)
Creates a new instance with the specifiedversion
,validateHeaders
, and the default decoder and encoder options (maxChunkSize (8192)
,maxHeaderSize (16384)
,compressionLevel (6)
,windowBits (15)
, andmemLevel (8)
).
-
SpdyFrameCodec
public SpdyFrameCodec(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel)
Creates a new instance with the specifiedversion
,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 specifiedversion
,validateHeaders
, decoder and encoder options.
-
SpdyFrameCodec
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)
-
-
Method Detail
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.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 classio.netty.handler.codec.ByteToMessageDecoder
- Throws:
Exception
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelReadComplete
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelReadComplete
in classio.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 interfaceio.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 interfaceio.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 interfaceio.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 interfaceio.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 interfaceio.netty.channel.ChannelOutboundHandler
- Throws:
Exception
-
read
public void read(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
read
in interfaceio.netty.channel.ChannelOutboundHandler
- Throws:
Exception
-
flush
public void flush(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
flush
in interfaceio.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 interfaceio.netty.channel.ChannelOutboundHandler
- Throws:
Exception
-
readDataFrame
public void readDataFrame(int streamId, boolean last, io.netty.buffer.ByteBuf data)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a DATA frame is received.- Specified by:
readDataFrame
in interfaceSpdyFrameDecoderDelegate
-
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 interfaceSpdyFrameDecoderDelegate
-
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 interfaceSpdyFrameDecoderDelegate
-
readRstStreamFrame
public void readRstStreamFrame(int streamId, int statusCode)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a RST_STREAM frame is received.- Specified by:
readRstStreamFrame
in interfaceSpdyFrameDecoderDelegate
-
readSettingsFrame
public void readSettingsFrame(boolean clearPersisted)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a SETTINGS frame is received. Settings are not included. See readSetting().- Specified by:
readSettingsFrame
in interfaceSpdyFrameDecoderDelegate
-
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 interfaceSpdyFrameDecoderDelegate
-
readSettingsEnd
public void readSettingsEnd()
Description copied from interface:SpdyFrameDecoderDelegate
Called when the entire SETTINGS frame has been received.- Specified by:
readSettingsEnd
in interfaceSpdyFrameDecoderDelegate
-
readPingFrame
public void readPingFrame(int id)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a PING frame is received.- Specified by:
readPingFrame
in interfaceSpdyFrameDecoderDelegate
-
readGoAwayFrame
public void readGoAwayFrame(int lastGoodStreamId, int statusCode)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a GOAWAY frame is received.- Specified by:
readGoAwayFrame
in interfaceSpdyFrameDecoderDelegate
-
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 interfaceSpdyFrameDecoderDelegate
-
readWindowUpdateFrame
public void readWindowUpdateFrame(int streamId, int deltaWindowSize)
Description copied from interface:SpdyFrameDecoderDelegate
Called when a WINDOW_UPDATE frame is received.- Specified by:
readWindowUpdateFrame
in interfaceSpdyFrameDecoderDelegate
-
readHeaderBlock
public void readHeaderBlock(io.netty.buffer.ByteBuf headerBlock)
Description copied from interface:SpdyFrameDecoderDelegate
Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.- Specified by:
readHeaderBlock
in interfaceSpdyFrameDecoderDelegate
-
readHeaderBlockEnd
public void readHeaderBlockEnd()
Description copied from interface:SpdyFrameDecoderDelegate
Called when an entire header block has been received.- Specified by:
readHeaderBlockEnd
in interfaceSpdyFrameDecoderDelegate
-
readFrameError
public void readFrameError(String message)
Description copied from interface:SpdyFrameDecoderDelegate
Called when an unrecoverable session error has occurred.- Specified by:
readFrameError
in interfaceSpdyFrameDecoderDelegate
-
-