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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final List<io.netty.util.AsciiString>
The set of headers that should not be directly copied when converting headers from HTTP to HTTP/2. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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, List<Object> out) protected void
encode
(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, List<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
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
handlerRemoved
-
Field Details
-
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 Details
-
AbstractHttp2StreamFrameCodec
protected AbstractHttp2StreamFrameCodec(boolean validateHeaders)
-
-
Method Details
-
acceptInboundMessage
- Overrides:
acceptInboundMessage
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,
io.netty.handler.codec.http.HttpObject> - Throws:
Exception
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2StreamFrame frame, List<Object> out) throws Exception - Specified by:
decode
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http2.Http2StreamFrame,
io.netty.handler.codec.http.HttpObject> - Throws:
Exception
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject obj, List<Object> out) throws 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:
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
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
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)
-