Package com.linkedin.alpini.netty4.http2
Class AbstractHttp2StreamFrameCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
-
- com.linkedin.alpini.netty4.http2.AbstractHttp2StreamFrameCodec
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
- Direct Known Subclasses:
Http2StreamFrameClientCodec
,Http2StreamFrameServerCodec
public abstract class AbstractHttp2StreamFrameCodec extends io.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
A copy of the netty Http2StreamFrameToHttpObjectCodec except with the methods which actually return the converted objects have been made abstract.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.List<io.netty.util.AsciiString>
HTTP_TO_HTTP2_HEADER_DENY_LIST
The set of headers that should not be directly copied when converting headers from HTTP to HTTP/2.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractHttp2StreamFrameCodec(boolean validateHeaders)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
acceptInboundMessage(java.lang.Object msg)
protected static io.netty.channel.Channel
connectionChannel(io.netty.channel.ChannelHandlerContext ctx)
protected static io.netty.handler.codec.http.HttpScheme
connectionScheme(io.netty.channel.ChannelHandlerContext ctx)
protected static io.netty.util.Attribute<io.netty.handler.codec.http.HttpScheme>
connectionSchemeAttribute(io.netty.channel.ChannelHandlerContext ctx)
protected void
decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2StreamFrame frame, java.util.List<java.lang.Object> out)
protected void
encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, java.util.List<java.lang.Object> out)
Encode from anHttpObject
to anHttp2StreamFrame
.void
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
protected boolean
isSsl(io.netty.channel.ChannelHandlerContext ctx)
protected abstract io.netty.handler.codec.http.FullHttpMessage
newFullMessage(int id, io.netty.handler.codec.http2.Http2Headers headers, boolean validateHeaders, io.netty.buffer.ByteBufAllocator alloc)
protected abstract io.netty.handler.codec.http.HttpMessage
newMessage(int id, io.netty.handler.codec.http2.Http2Headers headers, boolean validateHeaders)
protected abstract io.netty.handler.codec.http2.Http2Headers
toHttp2Headers(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpMessage msg, boolean validateHeaders)
-
Methods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptOutboundMessage, channelRead, write
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
acceptInboundMessage
public boolean acceptInboundMessage(java.lang.Object msg) throws java.lang.Exception
- Overrides:
acceptInboundMessage
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
- Throws:
java.lang.Exception
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2StreamFrame frame, java.util.List<java.lang.Object> out) throws java.lang.Exception
- Specified by:
decode
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
- Throws:
java.lang.Exception
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, java.util.List<java.lang.Object> out) throws java.lang.Exception
Encode from anHttpObject
to anHttp2StreamFrame
. This method will be called for each written message that can be handled by this encoder. NOTE: 100-Continue responses that are NOTFullHttpResponse
will be rejected.- Specified by:
encode
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,io.netty.handler.codec.http.HttpObject>
- Parameters:
ctx
- theChannelHandlerContext
which this handler belongs toobj
- theHttpObject
message to encodeout
- theList
into which the encoded msg should be added needs to do some kind of aggregation- Throws:
java.lang.Exception
- is thrown if an error occurs
-
toHttp2Headers
protected abstract io.netty.handler.codec.http2.Http2Headers toHttp2Headers(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpMessage msg, boolean validateHeaders) throws io.netty.handler.codec.http2.Http2Exception
- Throws:
io.netty.handler.codec.http2.Http2Exception
-
newMessage
protected abstract io.netty.handler.codec.http.HttpMessage newMessage(int id, io.netty.handler.codec.http2.Http2Headers headers, boolean validateHeaders) throws io.netty.handler.codec.http2.Http2Exception
- Throws:
io.netty.handler.codec.http2.Http2Exception
-
newFullMessage
protected abstract io.netty.handler.codec.http.FullHttpMessage newFullMessage(int id, io.netty.handler.codec.http2.Http2Headers headers, boolean validateHeaders, io.netty.buffer.ByteBufAllocator alloc) throws io.netty.handler.codec.http2.Http2Exception
- Throws:
io.netty.handler.codec.http2.Http2Exception
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
java.lang.Exception
-
isSsl
protected boolean isSsl(io.netty.channel.ChannelHandlerContext ctx)
-
connectionScheme
protected static io.netty.handler.codec.http.HttpScheme connectionScheme(io.netty.channel.ChannelHandlerContext ctx)
-
connectionSchemeAttribute
protected static io.netty.util.Attribute<io.netty.handler.codec.http.HttpScheme> connectionSchemeAttribute(io.netty.channel.ChannelHandlerContext ctx)
-
connectionChannel
protected static io.netty.channel.Channel connectionChannel(io.netty.channel.ChannelHandlerContext ctx)
-
-