Class BasicHttpContentEncoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http.HttpObject,io.netty.handler.codec.http.HttpObject>
com.linkedin.alpini.netty4.handlers.BasicHttpContentEncoder
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
public abstract class BasicHttpContentEncoder
extends io.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http.HttpObject,io.netty.handler.codec.http.HttpObject>
A replacement for the Netty HttpContentEncoder which can handle use in client and server pipelines.
Created by acurtis on 6/26/17.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
protected abstract io.netty.handler.codec.http.HttpContentEncoder.Result
beginEncode
(io.netty.handler.codec.http.HttpMessage headers, String acceptEncoding) Prepare to encode the HTTP message content.void
channelInactive
(io.netty.channel.ChannelHandlerContext ctx) protected void
decode
(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) protected void
decodeTime
(long nanos) protected void
encode
(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) protected void
encodeTime
(long nanos) void
handlerRemoved
(io.netty.channel.ChannelHandlerContext ctx) protected CharSequence
requestEncoding
(io.netty.handler.codec.http.HttpRequest request) protected CharSequence
requestEncoding0
(io.netty.handler.codec.http.HttpRequest request) Methods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptInboundMessage, 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, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, 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
-
Constructor Details
-
BasicHttpContentEncoder
public BasicHttpContentEncoder()
-
-
Method Details
-
acceptOutboundMessage
- Overrides:
acceptOutboundMessage
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http.HttpObject,
io.netty.handler.codec.http.HttpObject> - Throws:
Exception
-
requestEncoding
-
requestEncoding0
-
encodeTime
protected void encodeTime(long nanos) -
decodeTime
protected void decodeTime(long nanos) -
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) throws Exception - Specified by:
decode
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http.HttpObject,
io.netty.handler.codec.http.HttpObject> - Throws:
Exception
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpObject msg, List<Object> out) throws Exception - Specified by:
encode
in classio.netty.handler.codec.MessageToMessageCodec<io.netty.handler.codec.http.HttpObject,
io.netty.handler.codec.http.HttpObject> - Throws:
Exception
-
beginEncode
protected abstract io.netty.handler.codec.http.HttpContentEncoder.Result beginEncode(io.netty.handler.codec.http.HttpMessage headers, String acceptEncoding) throws Exception Prepare to encode the HTTP message content.- Parameters:
headers
- the headersacceptEncoding
- the value of the"Accept-Encoding"
header- Returns:
- the result of preparation, which is composed of the determined
target content encoding and a new
EmbeddedChannel
that encodes the content into the target content encoding.null
ifacceptEncoding
is unsupported or rejected and thus the content should be handled as-is (i.e. no encoding). - Throws:
Exception
-
handlerRemoved
- Specified by:
handlerRemoved
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerRemoved
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
channelInactive
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-