- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToMessageEncoder<Object>
-
- io.netty5.handler.codec.http.HttpObjectEncoder<HttpResponse>
-
- io.netty5.handler.codec.http.HttpResponseEncoder
-
- All Implemented Interfaces:
ChannelHandler
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 booleanacceptOutboundMessage(Object msg)Returnstrueif the given message should be handled.protected voidencodeInitialLine(Buffer buf, HttpResponse response)protected booleanisContentAlwaysEmpty(HttpResponse msg)Determine whether a message has a content or not.protected voidsanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty)Allows to sanitize headers of the message before encoding these.-
Methods inherited from class io.netty5.handler.codec.http.HttpObjectEncoder
crlfBuffer, encodeAndClose, encodeHeaders, zeroCrlfCrlfBuffer
-
Methods inherited from class io.netty5.handler.codec.MessageToMessageEncoder
encode, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
-
-
-
-
Method Detail
-
acceptOutboundMessage
public boolean acceptOutboundMessage(Object msg) throws Exception
Description copied from class:MessageToMessageEncoderReturnstrueif the given message should be handled. Iffalseit will be passed to the nextChannelHandlerin theChannelPipeline.- Overrides:
acceptOutboundMessagein classHttpObjectEncoder<HttpResponse>- Throws:
Exception
-
encodeInitialLine
protected void encodeInitialLine(Buffer buf, HttpResponse response) throws Exception
- Specified by:
encodeInitialLinein classHttpObjectEncoder<HttpResponse>- Throws:
Exception
-
sanitizeHeadersBeforeEncode
protected void sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty)
Description copied from class:HttpObjectEncoderAllows to sanitize headers of the message before encoding these.- Overrides:
sanitizeHeadersBeforeEncodein classHttpObjectEncoder<HttpResponse>
-
isContentAlwaysEmpty
protected boolean isContentAlwaysEmpty(HttpResponse msg)
Description copied from class:HttpObjectEncoderDetermine 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:
isContentAlwaysEmptyin classHttpObjectEncoder<HttpResponse>- Parameters:
msg- the message to test- Returns:
trueto signal the message has no content
-
-