Class SpdyFrameCodec
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.jboss.netty.handler.codec.frame.FrameDecoder
org.jboss.netty.handler.codec.spdy.SpdyFrameCodec
- All Implemented Interfaces:
ChannelDownstreamHandler,ChannelHandler,ChannelUpstreamHandler,LifeCycleAwareChannelHandler,SpdyFrameDecoderDelegate
public class SpdyFrameCodec
extends FrameDecoder
implements SpdyFrameDecoderDelegate, ChannelDownstreamHandler
A
ChannelHandler that encodes and decodes SPDY Frames.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ChannelHandlerContextprivate static final SpdyProtocolExceptionprivate final SpdyFrameDecoderprivate final SpdyFrameEncoderprivate final SpdyHeaderBlockDecoderprivate final SpdyHeaderBlockEncoderprivate SpdyHeadersFrameprivate SpdySettingsFrameFields inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder
cumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionSpdyFrameCodec(SpdyVersion version) Creates a new instance with the specifiedversionand 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 specified decoder and encoder options.protectedSpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidprotected Objectdecode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) Decodes the received packets so far into a frame.voidHandles the specified downstream event.voidreadDataFrame(int streamId, boolean last, ChannelBuffer data) Called when a DATA frame is received.voidreadFrameError(String message) Called when an unrecoverable session error has occurred.voidreadGoAwayFrame(int lastGoodStreamId, int statusCode) Called when a GOAWAY frame is received.voidreadHeaderBlock(ChannelBuffer headerBlock) Called when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.voidCalled when an entire header block has been received.voidreadHeadersFrame(int streamId, boolean last) Called when a HEADERS frame is received.voidreadPingFrame(int id) Called when a PING frame is received.voidreadRstStreamFrame(int streamId, int statusCode) Called when a RST_STREAM frame is received.voidreadSetting(int id, int value, boolean persistValue, boolean persisted) Called when an individual setting within a SETTINGS frame is received.voidCalled when the entire SETTINGS frame has been received.voidreadSettingsFrame(boolean clearPersisted) Called when a SETTINGS frame is received.voidreadSynReplyFrame(int streamId, boolean last) Called when a SYN_REPLY frame is received.voidreadSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional) Called when a SYN_STREAM frame is received.voidreadWindowUpdateFrame(int streamId, int deltaWindowSize) Called when a WINDOW_UPDATE frame is received.Methods inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder
actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeRemove, channelClosed, channelDisconnected, decodeLast, exceptionCaught, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, internalBuffer, isUnfold, messageReceived, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulationMethods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
-
Field Details
-
INVALID_FRAME
-
spdyFrameDecoder
-
spdyFrameEncoder
-
spdyHeaderBlockDecoder
-
spdyHeaderBlockEncoder
-
spdyHeadersFrame
-
spdySettingsFrame
-
ctx
-
-
Constructor Details
-
SpdyFrameCodec
Creates a new instance with the specifiedversionand 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 specified decoder and encoder options. -
SpdyFrameCodec
protected SpdyFrameCodec(SpdyVersion version, int maxChunkSize, SpdyHeaderBlockDecoder spdyHeaderBlockDecoder, SpdyHeaderBlockEncoder spdyHeaderBlockEncoder)
-
-
Method Details
-
beforeAdd
- Specified by:
beforeAddin interfaceLifeCycleAwareChannelHandler- Overrides:
beforeAddin classFrameDecoder- Throws:
Exception
-
decode
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception Description copied from class:FrameDecoderDecodes the received packets so far into a frame. If an sub-class wants to extract a frame out of the buffer it should use theFrameDecoder.extractFrame(ChannelBuffer, int, int)method, to make optimizations easier later.- Specified by:
decodein classFrameDecoder- Parameters:
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.- Returns:
- the decoded frame if a full frame was received and decoded.
nullif there's not enough data in the buffer to decode a frame. - Throws:
Exception
-
cleanup
Description copied from class:FrameDecoderGets called onFrameDecoder.channelDisconnected(ChannelHandlerContext, ChannelStateEvent)andFrameDecoder.channelClosed(ChannelHandlerContext, ChannelStateEvent)- Overrides:
cleanupin classFrameDecoder- Throws:
Exception
-
handleDownstream
Description copied from interface:ChannelDownstreamHandlerHandles the specified downstream event.- Specified by:
handleDownstreamin interfaceChannelDownstreamHandler- Parameters:
ctx- the context object for this handlerevt- the downstream event to process or intercept- Throws:
Exception
-
readDataFrame
Description copied from interface:SpdyFrameDecoderDelegateCalled when a DATA frame is received.- Specified by:
readDataFramein interfaceSpdyFrameDecoderDelegate
-
readSynStreamFrame
public void readSynStreamFrame(int streamId, int associatedToStreamId, byte priority, boolean last, boolean unidirectional) Description copied from interface:SpdyFrameDecoderDelegateCalled when a SYN_STREAM frame is received. The Name/Value Header Block is not included. See readHeaderBlock().- Specified by:
readSynStreamFramein interfaceSpdyFrameDecoderDelegate
-
readSynReplyFrame
public void readSynReplyFrame(int streamId, boolean last) Description copied from interface:SpdyFrameDecoderDelegateCalled when a SYN_REPLY frame is received. The Name/Value Header Block is not included. See readHeaderBlock().- Specified by:
readSynReplyFramein interfaceSpdyFrameDecoderDelegate
-
readRstStreamFrame
public void readRstStreamFrame(int streamId, int statusCode) Description copied from interface:SpdyFrameDecoderDelegateCalled when a RST_STREAM frame is received.- Specified by:
readRstStreamFramein interfaceSpdyFrameDecoderDelegate
-
readSettingsFrame
public void readSettingsFrame(boolean clearPersisted) Description copied from interface:SpdyFrameDecoderDelegateCalled when a SETTINGS frame is received. Settings are not included. See readSetting().- Specified by:
readSettingsFramein interfaceSpdyFrameDecoderDelegate
-
readSetting
public void readSetting(int id, int value, boolean persistValue, boolean persisted) Description copied from interface:SpdyFrameDecoderDelegateCalled when an individual setting within a SETTINGS frame is received.- Specified by:
readSettingin interfaceSpdyFrameDecoderDelegate
-
readSettingsEnd
public void readSettingsEnd()Description copied from interface:SpdyFrameDecoderDelegateCalled when the entire SETTINGS frame has been received.- Specified by:
readSettingsEndin interfaceSpdyFrameDecoderDelegate
-
readPingFrame
public void readPingFrame(int id) Description copied from interface:SpdyFrameDecoderDelegateCalled when a PING frame is received.- Specified by:
readPingFramein interfaceSpdyFrameDecoderDelegate
-
readGoAwayFrame
public void readGoAwayFrame(int lastGoodStreamId, int statusCode) Description copied from interface:SpdyFrameDecoderDelegateCalled when a GOAWAY frame is received.- Specified by:
readGoAwayFramein interfaceSpdyFrameDecoderDelegate
-
readHeadersFrame
public void readHeadersFrame(int streamId, boolean last) Description copied from interface:SpdyFrameDecoderDelegateCalled when a HEADERS frame is received. The Name/Value Header Block is not included. See readHeaderBlock().- Specified by:
readHeadersFramein interfaceSpdyFrameDecoderDelegate
-
readWindowUpdateFrame
public void readWindowUpdateFrame(int streamId, int deltaWindowSize) Description copied from interface:SpdyFrameDecoderDelegateCalled when a WINDOW_UPDATE frame is received.- Specified by:
readWindowUpdateFramein interfaceSpdyFrameDecoderDelegate
-
readHeaderBlock
Description copied from interface:SpdyFrameDecoderDelegateCalled when the header block within a SYN_STREAM, SYN_REPLY, or HEADERS frame is received.- Specified by:
readHeaderBlockin interfaceSpdyFrameDecoderDelegate
-
readHeaderBlockEnd
public void readHeaderBlockEnd()Description copied from interface:SpdyFrameDecoderDelegateCalled when an entire header block has been received.- Specified by:
readHeaderBlockEndin interfaceSpdyFrameDecoderDelegate
-
readFrameError
Description copied from interface:SpdyFrameDecoderDelegateCalled when an unrecoverable session error has occurred.- Specified by:
readFrameErrorin interfaceSpdyFrameDecoderDelegate
-