public class SpdyFrameCodec extends ByteToMessageDecoder implements SpdyFrameDecoderDelegate, ChannelOutboundHandler
ChannelHandler
that encodes and decodes SPDY Frames.ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
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. |
protected |
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
SpdyHeaderBlockDecoder spdyHeaderBlockDecoder,
SpdyHeaderBlockEncoder spdyHeaderBlockEncoder,
boolean validateHeaders) |
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 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.
|
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, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerRemoved
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.protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder, boolean validateHeaders)
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapter
handlerAdded
in interface ChannelHandler
handlerAdded
in class ChannelHandlerAdapter
Exception
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
ByteToMessageDecoder
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
.decode
in class ByteToMessageDecoder
ctx
- 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
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelReadComplete()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelReadComplete
in interface ChannelInboundHandler
channelReadComplete
in class ByteToMessageDecoder
Exception
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception
ChannelOutboundHandler
bind
in interface ChannelOutboundHandler
ctx
- 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
ChannelOutboundHandler
connect
in interface ChannelOutboundHandler
ctx
- 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
ChannelOutboundHandler
disconnect
in interface ChannelOutboundHandler
ctx
- 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
ChannelOutboundHandler
close
in interface ChannelOutboundHandler
ctx
- 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
ChannelOutboundHandler
EventLoop
.deregister
in interface ChannelOutboundHandler
ctx
- 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
ChannelOutboundHandler
ChannelHandlerContext.read()
.read
in interface ChannelOutboundHandler
Exception
public void flush(ChannelHandlerContext ctx) throws Exception
ChannelOutboundHandler
flush
in interface ChannelOutboundHandler
ctx
- the ChannelHandlerContext
for which the flush operation is madeException
- thrown if an error occurspublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
ChannelOutboundHandler
ChannelPipeline
. Those are then ready to be flushed to the actual Channel
once
Channel.flush()
is calledwrite
in interface ChannelOutboundHandler
ctx
- 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)
SpdyFrameDecoderDelegate
readDataFrame
in interface SpdyFrameDecoderDelegate
public void readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional)
SpdyFrameDecoderDelegate
readSynStreamFrame
in interface SpdyFrameDecoderDelegate
public void readSynReplyFrame(int streamId, boolean last)
SpdyFrameDecoderDelegate
readSynReplyFrame
in interface SpdyFrameDecoderDelegate
public void readRstStreamFrame(int streamId, int statusCode)
SpdyFrameDecoderDelegate
readRstStreamFrame
in interface SpdyFrameDecoderDelegate
public void readSettingsFrame(boolean clearPersisted)
SpdyFrameDecoderDelegate
readSettingsFrame
in interface SpdyFrameDecoderDelegate
public void readSetting(int id, int value, boolean persistValue, boolean persisted)
SpdyFrameDecoderDelegate
readSetting
in interface SpdyFrameDecoderDelegate
public void readSettingsEnd()
SpdyFrameDecoderDelegate
readSettingsEnd
in interface SpdyFrameDecoderDelegate
public void readPingFrame(int id)
SpdyFrameDecoderDelegate
readPingFrame
in interface SpdyFrameDecoderDelegate
public void readGoAwayFrame(int lastGoodStreamId, int statusCode)
SpdyFrameDecoderDelegate
readGoAwayFrame
in interface SpdyFrameDecoderDelegate
public void readHeadersFrame(int streamId, boolean last)
SpdyFrameDecoderDelegate
readHeadersFrame
in interface SpdyFrameDecoderDelegate
public void readWindowUpdateFrame(int streamId, int deltaWindowSize)
SpdyFrameDecoderDelegate
readWindowUpdateFrame
in interface SpdyFrameDecoderDelegate
public void readHeaderBlock(ByteBuf headerBlock)
SpdyFrameDecoderDelegate
readHeaderBlock
in interface SpdyFrameDecoderDelegate
public void readHeaderBlockEnd()
SpdyFrameDecoderDelegate
readHeaderBlockEnd
in interface SpdyFrameDecoderDelegate
public void readFrameError(String message)
SpdyFrameDecoderDelegate
readFrameError
in interface SpdyFrameDecoderDelegate
Copyright © 2008–2024 The Netty Project. All rights reserved.