Package io.netty.handler.codec.http
Class HttpResponseEncoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageEncoder<Object>
-
- io.netty.handler.codec.http.HttpObjectEncoder<HttpResponse>
-
- io.netty.handler.codec.http.HttpResponseEncoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelOutboundHandler
public class HttpResponseEncoder extends HttpObjectEncoder<HttpResponse>
-
-
Constructor Summary
Constructors Constructor Description HttpResponseEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptOutboundMessage(Object msg)
protected void
encodeInitialLine(io.netty.buffer.ByteBuf buf, HttpResponse response)
protected boolean
isContentAlwaysEmpty(HttpResponse msg)
Determine whether a message has a content or not.protected void
sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty)
Allows to sanitize headers of the message before encoding these.-
Methods inherited from class io.netty.handler.codec.http.HttpObjectEncoder
encode, encodeAscii, encodeHeaders, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
acceptOutboundMessage
public boolean acceptOutboundMessage(Object msg) throws Exception
- Overrides:
acceptOutboundMessage
in classHttpObjectEncoder<HttpResponse>
- Throws:
Exception
-
encodeInitialLine
protected void encodeInitialLine(io.netty.buffer.ByteBuf buf, HttpResponse response) throws Exception
- Specified by:
encodeInitialLine
in classHttpObjectEncoder<HttpResponse>
- Throws:
Exception
-
sanitizeHeadersBeforeEncode
protected void sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty)
Description copied from class:HttpObjectEncoder
Allows to sanitize headers of the message before encoding these.- Overrides:
sanitizeHeadersBeforeEncode
in classHttpObjectEncoder<HttpResponse>
-
isContentAlwaysEmpty
protected boolean isContentAlwaysEmpty(HttpResponse msg)
Description copied from class:HttpObjectEncoder
Determine whether a message has a content or not. Some message may have headers indicating a content without having an actual content, e.g the response to an HEAD or CONNECT request.- Overrides:
isContentAlwaysEmpty
in classHttpObjectEncoder<HttpResponse>
- Parameters:
msg
- the message to test- Returns:
true
to signal the message has no content
-
-