public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageToMessageEncoder<java.lang.Object>
HttpMessage或HttpContent编码为ByteBuf 。
ChannelHandler.Sharable| Constructor and Description |
|---|
HttpObjectEncoder() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptOutboundMessage(java.lang.Object msg)
如果应该处理给定的消息,则返回
true 。
|
protected void |
encode(ChannelHandlerContext ctx, java.lang.Object msg, java.util.List<java.lang.Object> out)
从一条消息编码到另一条消息。
|
protected static void |
encodeAscii(java.lang.String s, ByteBuf buf)
已过时。
|
protected void |
encodeHeaders(HttpHeaders headers, ByteBuf buf)
将 HttpHeaders编码为ByteBuf 。
|
protected abstract void |
encodeInitialLine(ByteBuf buf, H message) |
protected boolean |
isContentAlwaysEmpty(H msg)
确定消息是否包含内容。
|
protected void |
sanitizeHeadersBeforeEncode(H msg, boolean isAlwaysEmpty)
允许在编码这些消息之前清理消息的标题。
|
writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedprotected void encode(ChannelHandlerContext ctx, java.lang.Object msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoder
encode在课堂上
MessageToMessageEncoder<java.lang.Object>
ctx - 这MessageToMessageEncoder所属的ChannelHandlerContext
msg - 要编码到另一个的消息
out - 应该添加编码味精的
List需要做某种聚合
java.lang.Exception - 发生错误时抛出
protected void encodeHeaders(HttpHeaders headers, ByteBuf buf)
HttpHeaders编码为ByteBuf 。
protected void sanitizeHeadersBeforeEncode(H msg, boolean isAlwaysEmpty)
protected boolean isContentAlwaysEmpty(H msg)
msg - 要测试的消息
true以表示消息没有内容
public boolean acceptOutboundMessage(java.lang.Object msg)
throws java.lang.Exception
MessageToMessageEncoder
true 。
如果false它将被传递到ChannelPipeline中的下一个ChannelOutboundHandler 。
acceptOutboundMessage在课堂上
MessageToMessageEncoder<java.lang.Object>
java.lang.Exception
@Deprecated
protected static void encodeAscii(java.lang.String s,
ByteBuf buf)
Copyright © 2008–2018 The Netty Project. All rights reserved.