public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageToMessageEncoder<java.lang.Object>
HttpMessage or an HttpContent into
a ByteBuf.
ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
(package private) static byte[] |
CRLF |
private static ByteBuf |
CRLF_BUF |
private static int |
ST_CONTENT_ALWAYS_EMPTY |
private static int |
ST_CONTENT_CHUNK |
private static int |
ST_CONTENT_NON_CHUNK |
private static int |
ST_INIT |
private int |
state |
private static byte[] |
ZERO_CRLF |
private static byte[] |
ZERO_CRLF_CRLF |
private static ByteBuf |
ZERO_CRLF_CRLF_BUF |
| Constructor and Description |
|---|
HttpObjectEncoder() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptOutboundMessage(java.lang.Object msg)
Returns
true if the given message should be handled. |
private static long |
contentLength(java.lang.Object msg) |
protected void |
encode(ChannelHandlerContext ctx,
java.lang.Object msg,
java.util.List<java.lang.Object> out)
Encode from one message to an other.
|
private static java.lang.Object |
encodeAndRetain(java.lang.Object msg) |
protected static void |
encodeAscii(java.lang.String s,
ByteBuf buf)
Deprecated.
|
private void |
encodeChunkedContent(ChannelHandlerContext ctx,
java.lang.Object msg,
long contentLength,
java.util.List<java.lang.Object> out) |
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.
|
writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedstatic final byte[] CRLF
private static final byte[] ZERO_CRLF
private static final byte[] ZERO_CRLF_CRLF
private static final ByteBuf CRLF_BUF
private static final ByteBuf ZERO_CRLF_CRLF_BUF
private static final int ST_INIT
private static final int ST_CONTENT_NON_CHUNK
private static final int ST_CONTENT_CHUNK
private static final int ST_CONTENT_ALWAYS_EMPTY
private int state
protected void encode(ChannelHandlerContext ctx, java.lang.Object msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoderencode in class 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) throws java.lang.Exception
HttpHeaders into a ByteBuf.java.lang.Exceptionprivate void encodeChunkedContent(ChannelHandlerContext ctx, java.lang.Object msg, long contentLength, java.util.List<java.lang.Object> out)
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 in class MessageToMessageEncoder<java.lang.Object>java.lang.Exceptionprivate static java.lang.Object encodeAndRetain(java.lang.Object msg)
private static long contentLength(java.lang.Object msg)
@Deprecated
protected static void encodeAscii(java.lang.String s,
ByteBuf buf)