Top Description Fields Constructors Methods
io.netty.handler.codec.spdy

public Class SpdyFrameCodec

extends ByteToMessageDecoder
implements SpdyFrameDecoderDelegate, ChannelOutboundHandler
Class Inheritance
All Implemented Interfaces
io.netty.channel.ChannelOutboundHandler, io.netty.channel.ChannelHandler, io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelFuture, .ChannelFutureListener, .ChannelHandler, .ChannelHandlerContext, .ChannelOutboundHandler, .ChannelPromise, io.netty.handler.codec.ByteToMessageDecoder, .UnsupportedMessageTypeException, java.net.SocketAddress, java.util.List

A ChannelHandler that encodes and decodes SPDY Frames.

Field Summary

Modifier and TypeField and Description
private ChannelHandlerContext
private static final SpdyProtocolException
private boolean
private final SpdyFrameDecoder
private final SpdyFrameEncoder
private final SpdyHeaderBlockDecoder
private final SpdyHeaderBlockEncoder
private SpdyHeadersFrame
private SpdySettingsFrame
private final boolean
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
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)).

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)).

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.

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.

protected
SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)

Method Summary

Modifier and TypeMethod and Description
public void
bind(ChannelHandlerContext
the ChannelHandlerContext for which the bind operation is made
ctx
,
SocketAddress
the SocketAddress to which it should bound
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.
public void
public void
close(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.
public void
connect(ChannelHandlerContext
the ChannelHandlerContext for which the connect operation is made
ctx
,
SocketAddress
the SocketAddress to which it should connect
remoteAddress
,
SocketAddress
the SocketAddress which is used as source on connect
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
public void
deregister(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.
public void
disconnect(ChannelHandlerContext
the ChannelHandlerContext for which the disconnect operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.
public void
flush(ChannelHandlerContext
the ChannelHandlerContext for which the flush operation is made
ctx
)

Implements io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made.
public void
handlerAdded(ChannelHandlerContext ctx)

Overrides io.netty.channel.ChannelHandlerAdapter.handlerAdded.

Implements io.netty.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
public void
public void
readDataFrame(int streamId, boolean last, ByteBuf data)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readDataFrame.

Called when a DATA frame is received.
public void
readFrameError(String message)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readFrameError.

Called when an unrecoverable session error has occurred.
public void
readGoAwayFrame(int lastGoodStreamId, int statusCode)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readGoAwayFrame.

Called when a GOAWAY frame is received.
public void
readHeaderBlock(ByteBuf headerBlock)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlock.

Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.
public void
readHeaderBlockEnd()

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlockEnd.

Called when an entire header block has been received.
public void
readHeadersFrame(int streamId, boolean last)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeadersFrame.

Called when a HEADERS frame is received.
public void
readPingFrame(int id)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readPingFrame.

Called when a PING frame is received.
public void
readRstStreamFrame(int streamId, int statusCode)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readRstStreamFrame.

Called when a RST_STREAM frame is received.
public void
readSetting(int id, int value, boolean persistValue, boolean persisted)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSetting.

Called when an individual setting within a SETTINGS frame is received.
public void
readSettingsEnd()

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsEnd.

Called when the entire SETTINGS frame has been received.
public void
readSettingsFrame(boolean clearPersisted)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsFrame.

Called when a SETTINGS frame is received.
public void
readSynReplyFrame(int streamId, boolean last)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynReplyFrame.

Called when a SYN_REPLY frame is received.
public void
readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynStreamFrame.

Called when a SYN_STREAM frame is received.
public void
readWindowUpdateFrame(int streamId, int deltaWindowSize)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readWindowUpdateFrame.

Called when a WINDOW_UPDATE frame is received.
public void
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.write.

Called once a write operation is made.
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
actualReadableBytescallDecodechannelInactivechannelReaddecodeLastdiscardSomeReadByteshandlerRemovedhandlerRemoved0internalBufferisSingleDecodesetCumulatorsetDiscardAfterReadssetSingleDecodeuserEventTriggered

Field Detail

ctxback to summary
private ChannelHandlerContext ctx
INVALID_FRAMEback to summary
private static final SpdyProtocolException INVALID_FRAME
readback to summary
private boolean read
spdyFrameDecoderback to summary
private final SpdyFrameDecoder spdyFrameDecoder
spdyFrameEncoderback to summary
private final SpdyFrameEncoder spdyFrameEncoder
spdyHeaderBlockDecoderback to summary
private final SpdyHeaderBlockDecoder spdyHeaderBlockDecoder
spdyHeaderBlockEncoderback to summary
private final SpdyHeaderBlockEncoder spdyHeaderBlockEncoder
spdyHeadersFrameback to summary
private SpdyHeadersFrame spdyHeadersFrame
spdySettingsFrameback to summary
private SpdySettingsFrame spdySettingsFrame
validateHeadersback to summary
private final boolean validateHeaders

Constructor Detail

SpdyFrameCodecback to summary
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)).

SpdyFrameCodecback to summary
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)).

SpdyFrameCodecback to summary
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.

SpdyFrameCodecback to summary
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.

SpdyFrameCodecback to summary
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)

Method Detail

bindback to summary
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.bind.

Doc from io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the bind operation is made

localAddress:SocketAddress

the SocketAddress to which it should bound

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
channelReadCompleteback to summary
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.handler.codec.ByteToMessageDecoder.channelReadComplete.

Implements io.netty.channel.ChannelInboundHandler.channelReadComplete.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelReadComplete.

Calls ChannelHandlerContext#fireChannelReadComplete() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
closeback to summary
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.close.

Doc from io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
connectback to summary
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.connect.

Doc from io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the connect operation is made

remoteAddress:SocketAddress

the SocketAddress to which it should connect

localAddress:SocketAddress

the SocketAddress which is used as source on connect

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
deregisterback to summary
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
disconnectback to summary
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the disconnect operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
flushback to summary
public void flush(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.flush.

Doc from io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the flush operation is made

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
handlerAddedback to summary
public void handlerAdded(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelHandlerAdapter.handlerAdded.

Implements io.netty.channel.ChannelHandler.handlerAdded.

Doc from io.netty.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.

Annotations
@Override
readback to summary
public void read(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.read.

Doc from io.netty.channel.ChannelOutboundHandler.read.

Intercepts ChannelHandlerContext#read().

Annotations
@Override
readDataFrameback to summary
public void readDataFrame(int streamId, boolean last, ByteBuf data)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readDataFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readDataFrame.

Called when a DATA frame is received.

Annotations
@Override
readFrameErrorback to summary
public void readFrameError(String message)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readFrameError.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readFrameError.

Called when an unrecoverable session error has occurred.

Annotations
@Override
readGoAwayFrameback to summary
public void readGoAwayFrame(int lastGoodStreamId, int statusCode)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readGoAwayFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readGoAwayFrame.

Called when a GOAWAY frame is received.

Annotations
@Override
readHeaderBlockback to summary
public void readHeaderBlock(ByteBuf headerBlock)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlock.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlock.

Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.

Annotations
@Override
readHeaderBlockEndback to summary
public void readHeaderBlockEnd()

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlockEnd.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeaderBlockEnd.

Called when an entire header block has been received.

Annotations
@Override
readHeadersFrameback to summary
public void readHeadersFrame(int streamId, boolean last)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeadersFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readHeadersFrame.

Called when a HEADERS frame is received. The Name/Value Header Block is not included. See readHeaderBlock().

Annotations
@Override
readPingFrameback to summary
public void readPingFrame(int id)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readPingFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readPingFrame.

Called when a PING frame is received.

Annotations
@Override
readRstStreamFrameback to summary
public void readRstStreamFrame(int streamId, int statusCode)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readRstStreamFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readRstStreamFrame.

Called when a RST_STREAM frame is received.

Annotations
@Override
readSettingback to summary
public void readSetting(int id, int value, boolean persistValue, boolean persisted)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSetting.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSetting.

Called when an individual setting within a SETTINGS frame is received.

Annotations
@Override
readSettingsEndback to summary
public void readSettingsEnd()

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsEnd.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsEnd.

Called when the entire SETTINGS frame has been received.

Annotations
@Override
readSettingsFrameback to summary
public void readSettingsFrame(boolean clearPersisted)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSettingsFrame.

Called when a SETTINGS frame is received. Settings are not included. See readSetting().

Annotations
@Override
readSynReplyFrameback to summary
public void readSynReplyFrame(int streamId, boolean last)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynReplyFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynReplyFrame.

Called when a SYN_REPLY frame is received. The Name/Value Header Block is not included. See readHeaderBlock().

Annotations
@Override
readSynStreamFrameback to summary
public void readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynStreamFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readSynStreamFrame.

Called when a SYN_STREAM frame is received. The Name/Value Header Block is not included. See readHeaderBlock().

Annotations
@Override
readWindowUpdateFrameback to summary
public void readWindowUpdateFrame(int streamId, int deltaWindowSize)

Implements io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readWindowUpdateFrame.

Doc from io.netty.handler.codec.spdy.SpdyFrameDecoderDelegate.readWindowUpdateFrame.

Called when a WINDOW_UPDATE frame is received.

Annotations
@Override
writeback to summary
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.write.

Doc from io.netty.channel.ChannelOutboundHandler.write.

Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel#flush() is called

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the write operation is made

msg:Object

the message to write

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs