public class SpdyFrameCodec extends ByteToMessageDecoder implements SpdyFrameDecoderDelegate, ChannelOutboundHandler
ChannelHandler that encodes and decodes SPDY Frames.ByteToMessageDecoder.CumulatorChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
protected static SpdyProtocolException |
INVALID_FRAME |
protected SpdyFrameDecoder |
spdyFrameDecoder |
protected SpdyFrameEncoder |
spdyFrameEncoder |
COMPOSITE_CUMULATOR, MERGE_CUMULATOR| Modifier | Constructor and 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. |
|
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
int maxHeaderSize,
int compressionLevel,
int windowBits,
int memLevel,
boolean validateHeaders,
boolean supportsUnknownFrames)
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) |
protected |
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
SpdyHeaderBlockDecoder spdyHeaderBlockDecoder,
SpdyHeaderBlockEncoder spdyHeaderBlockEncoder,
boolean validateHeaders,
boolean supportsUnknownFrames) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(ChannelHandlerContext ctx,
SocketAddress localAddress,
ChannelPromise promise)
Called once a bind operation is made.
|
void |
channelReadComplete(ChannelHandlerContext ctx)
Calls
ChannelHandlerContext.fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline. |
void |
close(ChannelHandlerContext ctx,
ChannelPromise promise)
Called once a close operation is made.
|
void |
connect(ChannelHandlerContext ctx,
SocketAddress remoteAddress,
SocketAddress localAddress,
ChannelPromise promise)
Called once a connect operation is made.
|
protected SpdyFrameDecoder |
createDecoder(SpdyVersion version,
SpdyFrameDecoderDelegate delegate,
int maxChunkSize) |
protected SpdyFrameEncoder |
createEncoder(SpdyVersion version) |
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
List<Object> out)
Decode the from one
ByteBuf to an other. |
void |
deregister(ChannelHandlerContext ctx,
ChannelPromise promise)
Called once a deregister operation is made from the current registered
EventLoop. |
void |
disconnect(ChannelHandlerContext ctx,
ChannelPromise promise)
Called once a disconnect operation is made.
|
void |
flush(ChannelHandlerContext ctx)
Called once a flush operation is made.
|
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
protected boolean |
isValidUnknownFrameHeader(int streamId,
int type,
byte flags,
int length)
Check whether the unknown frame is valid, if not, the frame will be discarded,
otherwise, the frame will be passed to
SpdyFrameDecoder.decodeUnknownFrame(int, byte, int, ByteBuf). |
protected SpdyFrame |
newSpdyUnknownFrame(int frameType,
byte flags,
ByteBuf payload)
Create a SpdyUnknownFrame.
|
void |
read(ChannelHandlerContext ctx)
Intercepts
ChannelHandlerContext.read(). |
void |
readDataFrame(int streamId,
boolean last,
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(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(ChannelHandlerContext ctx,
Object msg,
ChannelPromise promise)
Called once a write operation is made.
|
actualReadableBytes, callDecode, channelInactive, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerRemovedprotected static final SpdyProtocolException INVALID_FRAME
protected final SpdyFrameDecoder spdyFrameDecoder
protected final SpdyFrameEncoder spdyFrameEncoder
public SpdyFrameCodec(SpdyVersion version)
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)
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)
version, validateHeaders (true),
decoder and encoder options.public SpdyFrameCodec(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel, boolean validateHeaders)
version, validateHeaders,
decoder and encoder options.public SpdyFrameCodec(SpdyVersion version, int maxChunkSize, int maxHeaderSize, int compressionLevel, int windowBits, int memLevel, boolean validateHeaders, boolean supportsUnknownFrames)
version, validateHeaders,
decoder and encoder options.protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders, boolean supportsUnknownFrames)
protected SpdyFrameDecoder createDecoder(SpdyVersion version, SpdyFrameDecoderDelegate delegate, int maxChunkSize)
protected SpdyFrameEncoder createEncoder(SpdyVersion version)
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionprotected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
ByteToMessageDecoderByteBuf 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.decode in class ByteToMessageDecoderctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataout - the List to which decoded messages should be addedException - is thrown if an error occurspublic void channelReadComplete(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelReadComplete in interface ChannelInboundHandlerchannelReadComplete in class ByteToMessageDecoderExceptionpublic void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception
ChannelOutboundHandlerbind in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the bind operation is madelocalAddress - the SocketAddress to which it should boundpromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception
ChannelOutboundHandlerconnect in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the connect operation is maderemoteAddress - the SocketAddress to which it should connectlocalAddress - the SocketAddress which is used as source on connectpromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelOutboundHandlerdisconnect in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the disconnect operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelOutboundHandlerclose in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelOutboundHandlerEventLoop.deregister in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void read(ChannelHandlerContext ctx) throws Exception
ChannelOutboundHandlerChannelHandlerContext.read().read in interface ChannelOutboundHandlerExceptionpublic void flush(ChannelHandlerContext ctx) throws Exception
ChannelOutboundHandlerflush in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the flush operation is madeException - thrown if an error occurspublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
ChannelOutboundHandlerChannelPipeline. Those are then ready to be flushed to the actual Channel once
Channel.flush() is calledwrite in interface ChannelOutboundHandlerctx - the ChannelHandlerContext for which the write operation is mademsg - the message to writepromise - the ChannelPromise to notify once the operation completesException - thrown if an error occurspublic void readDataFrame(int streamId,
boolean last,
ByteBuf data)
SpdyFrameDecoderDelegatereadDataFrame in interface SpdyFrameDecoderDelegatepublic void readSynStreamFrame(int streamId,
int associatedToStreamId,
byte priority,
boolean last,
boolean unidirectional)
SpdyFrameDecoderDelegatereadSynStreamFrame in interface SpdyFrameDecoderDelegatepublic void readSynReplyFrame(int streamId,
boolean last)
SpdyFrameDecoderDelegatereadSynReplyFrame in interface SpdyFrameDecoderDelegatepublic void readRstStreamFrame(int streamId,
int statusCode)
SpdyFrameDecoderDelegatereadRstStreamFrame in interface SpdyFrameDecoderDelegatepublic void readSettingsFrame(boolean clearPersisted)
SpdyFrameDecoderDelegatereadSettingsFrame in interface SpdyFrameDecoderDelegatepublic void readSetting(int id,
int value,
boolean persistValue,
boolean persisted)
SpdyFrameDecoderDelegatereadSetting in interface SpdyFrameDecoderDelegatepublic void readSettingsEnd()
SpdyFrameDecoderDelegatereadSettingsEnd in interface SpdyFrameDecoderDelegatepublic void readPingFrame(int id)
SpdyFrameDecoderDelegatereadPingFrame in interface SpdyFrameDecoderDelegatepublic void readGoAwayFrame(int lastGoodStreamId,
int statusCode)
SpdyFrameDecoderDelegatereadGoAwayFrame in interface SpdyFrameDecoderDelegatepublic void readHeadersFrame(int streamId,
boolean last)
SpdyFrameDecoderDelegatereadHeadersFrame in interface SpdyFrameDecoderDelegatepublic void readWindowUpdateFrame(int streamId,
int deltaWindowSize)
SpdyFrameDecoderDelegatereadWindowUpdateFrame in interface SpdyFrameDecoderDelegatepublic void readHeaderBlock(ByteBuf headerBlock)
SpdyFrameDecoderDelegatereadHeaderBlock in interface SpdyFrameDecoderDelegatepublic void readHeaderBlockEnd()
SpdyFrameDecoderDelegatereadHeaderBlockEnd in interface SpdyFrameDecoderDelegateprotected SpdyFrame newSpdyUnknownFrame(int frameType, byte flags, ByteBuf payload)
protected boolean isValidUnknownFrameHeader(int streamId,
int type,
byte flags,
int length)
SpdyFrameDecoder.decodeUnknownFrame(int, byte, int, ByteBuf).
By default this method always returns false, sub-classes may override this.
public void readFrameError(String message)
SpdyFrameDecoderDelegatereadFrameError in interface SpdyFrameDecoderDelegateCopyright © 2008–2025 The Netty Project. All rights reserved.