public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageToMessageEncoder<java.lang.Object>
HttpMessage or an HttpContent into
a ByteBuf.
ChannelHandler.Sharable| 构造器和说明 |
|---|
HttpObjectEncoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acceptOutboundMessage(java.lang.Object msg)
Returns
true if the given message should be handled. |
protected void |
encode(ChannelHandlerContext ctx,
java.lang.Object msg,
java.util.List<java.lang.Object> out)
Encode from one message to an other.
|
protected static void |
encodeAscii(java.lang.String s,
ByteBuf buf)
已过时。
|
protected void |
encodeHeaders(HttpHeaders headers,
ByteBuf buf)
Encode the
HttpHeaders into a ByteBuf. |
protected abstract void |
encodeInitialLine(ByteBuf buf,
H message) |
protected boolean |
isContentAlwaysEmpty(H msg)
Determine whether a message has a content or not.
|
protected void |
sanitizeHeadersBeforeEncode(H msg,
boolean isAlwaysEmpty)
Allows to sanitize headers of the message before encoding these.
|
void |
write(ChannelHandlerContext ctx,
java.lang.Object msg,
ChannelPromise promise)
Calls
ChannelOutboundInvoker.write(Object, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline. |
bind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
ChannelOutboundHandlerAdapterChannelOutboundInvoker.write(Object, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.write 在接口中 ChannelOutboundHandlerwrite 在类中 MessageToMessageEncoder<java.lang.Object>ctx - the ChannelHandlerContext for which the write operation is mademsg - the message to writepromise - the ChannelPromise to notify once the operation completesjava.lang.Exception - thrown if an error occursprotected void encode(ChannelHandlerContext ctx, java.lang.Object msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoderencode 在类中 MessageToMessageEncoder<java.lang.Object>ctx - the ChannelHandlerContext which this MessageToMessageEncoder belongs tomsg - the message to encode to an other oneout - the List into which the encoded msg should be added
needs to do some kind of aggregationjava.lang.Exception - is thrown if an error occursprotected void encodeHeaders(HttpHeaders headers, ByteBuf buf)
HttpHeaders into a ByteBuf.protected void sanitizeHeadersBeforeEncode(H msg, boolean isAlwaysEmpty)
protected boolean isContentAlwaysEmpty(H msg)
msg - the message to testtrue to signal the message has no contentpublic boolean acceptOutboundMessage(java.lang.Object msg)
throws java.lang.Exception
MessageToMessageEncodertrue if the given message should be handled. If false it will be passed to the next
ChannelOutboundHandler in the ChannelPipeline.acceptOutboundMessage 在类中 MessageToMessageEncoder<java.lang.Object>java.lang.Exception@Deprecated
protected static void encodeAscii(java.lang.String s,
ByteBuf buf)