public class SpdyFrameCodec extends FrameDecoder implements SpdyFrameDecoderDelegate, ChannelDownstreamHandler
ChannelHandler
that encodes and decodes SPDY Frames.ChannelHandler.Sharable
cumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
Modifier | Constructor and Description |
---|---|
|
SpdyFrameCodec(SpdyVersion version)
Creates a new instance with the specified
version 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 decoder and encoder options.
|
protected |
SpdyFrameCodec(SpdyVersion version,
int maxChunkSize,
org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockDecoder spdyHeaderBlockDecoder,
org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockEncoder spdyHeaderBlockEncoder) |
Modifier and Type | Method and Description |
---|---|
void |
beforeAdd(ChannelHandlerContext ctx) |
protected void |
cleanup(ChannelHandlerContext ctx,
ChannelStateEvent e)
|
protected Object |
decode(ChannelHandlerContext ctx,
Channel channel,
ChannelBuffer buffer)
Decodes the received packets so far into a frame.
|
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified downstream event.
|
void |
readDataFrame(int streamId,
boolean last,
ChannelBuffer 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(ChannelBuffer 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.
|
actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeRemove, channelClosed, channelDisconnected, decodeLast, exceptionCaught, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, internalBuffer, isUnfold, messageReceived, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulation
channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
public SpdyFrameCodec(SpdyVersion version)
version
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)
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, org.jboss.netty.handler.codec.spdy.SpdyHeaderBlockEncoder spdyHeaderBlockEncoder)
public void beforeAdd(ChannelHandlerContext ctx) throws Exception
beforeAdd
in interface LifeCycleAwareChannelHandler
beforeAdd
in class FrameDecoder
Exception
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception
FrameDecoder
FrameDecoder.extractFrame(ChannelBuffer, int, int)
method,
to make optimizations easier later.decode
in class FrameDecoder
ctx
- the context of this handlerchannel
- the current channelbuffer
- the cumulative buffer of received packets so far.
Note that the buffer might be empty, which means you
should not make an assumption that the buffer contains
at least one byte in your decoder implementation.null
if there's not enough data in the buffer to decode a frame.Exception
protected void cleanup(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
FrameDecoder
FrameDecoder.channelDisconnected(ChannelHandlerContext, ChannelStateEvent)
and
FrameDecoder.channelClosed(ChannelHandlerContext, ChannelStateEvent)
cleanup
in class FrameDecoder
Exception
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws Exception
ChannelDownstreamHandler
handleDownstream
in interface ChannelDownstreamHandler
ctx
- the context object for this handlerevt
- the downstream event to process or interceptException
public void readDataFrame(int streamId, boolean last, ChannelBuffer 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(ChannelBuffer 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-2015 The Netty Project. All Rights Reserved.