Package io.netty.handler.codec.spdy
Class SpdyHttpDecoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.MessageToMessageDecoder<SpdyFrame>
io.netty.handler.codec.spdy.SpdyHttpDecoder
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
Decodes
SpdySynStreamFrame
s, SpdySynReplyFrame
s,
and SpdyDataFrame
s into FullHttpRequest
s and FullHttpResponse
s.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpHeadersFactory
private final int
private final Map
<Integer, FullHttpMessage> private final int
private final HttpHeadersFactory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionSpdyHttpDecoder
(SpdyVersion version, int maxContentLength) Creates a new instance.SpdyHttpDecoder
(SpdyVersion version, int maxContentLength, boolean validateHeaders) Deprecated.protected
SpdyHttpDecoder
(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap) Creates a new instance with the specified parameters.protected
SpdyHttpDecoder
(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap, boolean validateHeaders) Deprecated.Use theSpdyHttpDecoder(SpdyVersion, int, Map, HttpHeadersFactory, HttpHeadersFactory)
constructor instead.protected
SpdyHttpDecoder
(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap, HttpHeadersFactory headersFactory, HttpHeadersFactory trailersFactory) Creates a new instance with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
CallsChannelHandlerContext.fireChannelInactive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.private static FullHttpRequest
createHttpRequest
(SpdyHeadersFrame requestFrame, ByteBufAllocator alloc) private FullHttpResponse
createHttpResponse
(SpdyHeadersFrame responseFrame, ByteBufAllocator alloc) protected void
decode
(ChannelHandlerContext ctx, SpdyFrame msg, List<Object> out) Decode from one message to an other.protected FullHttpMessage
getMessage
(int streamId) protected FullHttpMessage
putMessage
(int streamId, FullHttpMessage message) protected FullHttpMessage
removeMessage
(int streamId) Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
spdyVersion
private final int spdyVersion -
maxContentLength
private final int maxContentLength -
messageMap
-
headersFactory
-
trailersFactory
-
-
Constructor Details
-
SpdyHttpDecoder
Creates a new instance.- Parameters:
version
- the protocol versionmaxContentLength
- the maximum length of the message content. If the length of the message content exceeds this value, aTooLongFrameException
will be raised.
-
SpdyHttpDecoder
@Deprecated public SpdyHttpDecoder(SpdyVersion version, int maxContentLength, boolean validateHeaders) Deprecated.Use theSpdyHttpDecoder(SpdyVersion, int, Map, HttpHeadersFactory, HttpHeadersFactory)
constructor instead.Creates a new instance.- Parameters:
version
- the protocol versionmaxContentLength
- the maximum length of the message content. If the length of the message content exceeds this value, aTooLongFrameException
will be raised.validateHeaders
-true
if http headers should be validated
-
SpdyHttpDecoder
protected SpdyHttpDecoder(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap) Creates a new instance with the specified parameters.- Parameters:
version
- the protocol versionmaxContentLength
- the maximum length of the message content. If the length of the message content exceeds this value, aTooLongFrameException
will be raised.messageMap
- theMap
used to hold partially received messages.
-
SpdyHttpDecoder
@Deprecated protected SpdyHttpDecoder(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap, boolean validateHeaders) Deprecated.Use theSpdyHttpDecoder(SpdyVersion, int, Map, HttpHeadersFactory, HttpHeadersFactory)
constructor instead.Creates a new instance with the specified parameters.- Parameters:
version
- the protocol versionmaxContentLength
- the maximum length of the message content. If the length of the message content exceeds this value, aTooLongFrameException
will be raised.messageMap
- theMap
used to hold partially received messages.validateHeaders
-true
if http headers should be validated
-
SpdyHttpDecoder
protected SpdyHttpDecoder(SpdyVersion version, int maxContentLength, Map<Integer, FullHttpMessage> messageMap, HttpHeadersFactory headersFactory, HttpHeadersFactory trailersFactory) Creates a new instance with the specified parameters.- Parameters:
version
- the protocol versionmaxContentLength
- the maximum length of the message content. If the length of the message content exceeds this value, aTooLongFrameException
will be raised.messageMap
- theMap
used to hold partially received messages.headersFactory
- The factory used for creating HTTP headerstrailersFactory
- The factory used for creating HTTP trailers.
-
-
Method Details
-
channelInactive
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelInactive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelInactive
in interfaceChannelInboundHandler
- Overrides:
channelInactive
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
putMessage
-
getMessage
-
removeMessage
-
decode
Description copied from class:MessageToMessageDecoder
Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.- Specified by:
decode
in classMessageToMessageDecoder<SpdyFrame>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToMessageDecoder
belongs tomsg
- the message to decode to an other oneout
- theList
to which decoded messages should be added- Throws:
Exception
- is thrown if an error occurs
-
createHttpRequest
private static FullHttpRequest createHttpRequest(SpdyHeadersFrame requestFrame, ByteBufAllocator alloc) throws Exception - Throws:
Exception
-
createHttpResponse
private FullHttpResponse createHttpResponse(SpdyHeadersFrame responseFrame, ByteBufAllocator alloc) throws Exception - Throws:
Exception
-
SpdyHttpDecoder(SpdyVersion, int, Map, HttpHeadersFactory, HttpHeadersFactory)
constructor instead.