encodeFullHttpMessage() — netty Function Reference
Architecture documentation for the encodeFullHttpMessage() function in HttpObjectEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b7f03547_801e_f8bc_8cf5_573799e43a8c["encodeFullHttpMessage()"] 14c61705_9541_276a_37fa_eaab6f15ec5a["HttpObjectEncoder"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|defined in| 14c61705_9541_276a_37fa_eaab6f15ec5a 18cc7b78_3c6e_f726_9bf6_777174f30988["encode()"] 18cc7b78_3c6e_f726_9bf6_777174f30988 -->|calls| b7f03547_801e_f8bc_8cf5_573799e43a8c a269521d_6b98_a05f_40e6_74c9bd5dcc51["throwUnexpectedMessageTypeEx()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| a269521d_6b98_a05f_40e6_74c9bd5dcc51 4b97ef27_f6d0_bfb2_f13b_e90cabf9295e["isContentAlwaysEmpty()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| 4b97ef27_f6d0_bfb2_f13b_e90cabf9295e b43fe221_202b_29ad_16a6_78e27c3b8866["encodeInitialLine()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| b43fe221_202b_29ad_16a6_78e27c3b8866 8dfd04e1_69f2_a8a4_5337_494907eb60a3["sanitizeHeadersBeforeEncode()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| 8dfd04e1_69f2_a8a4_5337_494907eb60a3 b3b89c92_5298_f5c5_d6a1_4c89ee133142["encodeHeaders()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| b3b89c92_5298_f5c5_d6a1_4c89ee133142 c9b839f5_b11e_076e_2e87_574417154e52["padSizeForAccumulation()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| c9b839f5_b11e_076e_2e87_574417154e52 ebe34bd0_65f8_4408_a145_1b7768631692["encodeByteBufHttpContent()"] b7f03547_801e_f8bc_8cf5_573799e43a8c -->|calls| ebe34bd0_65f8_4408_a145_1b7768631692 style b7f03547_801e_f8bc_8cf5_573799e43a8c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java lines 307–350
private void encodeFullHttpMessage(ChannelHandlerContext ctx, Object o, List<Object> out)
throws Exception {
assert o instanceof FullHttpMessage;
final FullHttpMessage msg = (FullHttpMessage) o;
try {
if (state != ST_INIT) {
throwUnexpectedMessageTypeEx(o, state);
}
final H m = (H) o;
final int state = isContentAlwaysEmpty(m) ? ST_CONTENT_ALWAYS_EMPTY :
HttpUtil.isTransferEncodingChunked(m) ? ST_CONTENT_CHUNK : ST_CONTENT_NON_CHUNK;
ByteBuf content = msg.content();
final boolean accountForContentSize = content.readableBytes() > 0 &&
state == ST_CONTENT_NON_CHUNK &&
// try embed the content if less or equals than
// the biggest of ~12.5% of the header estimated size and COPY_DATA_THRESHOLD:
// it limits a wrong estimation to waste too much memory
content.readableBytes() <=
Math.max(COPY_CONTENT_THRESHOLD, ((int) headersEncodedSizeAccumulator) / 8);
final int headersAndContentSize = (int) headersEncodedSizeAccumulator +
(accountForContentSize? content.readableBytes() : 0);
final ByteBuf buf = ctx.alloc().buffer(headersAndContentSize);
encodeInitialLine(buf, m);
sanitizeHeadersBeforeEncode(m, state == ST_CONTENT_ALWAYS_EMPTY);
encodeHeaders(m.headers(), buf);
ByteBufUtil.writeShortBE(buf, CRLF_SHORT);
// don't consider the copyContent case here: the statistics is just related the headers
headersEncodedSizeAccumulator = HEADERS_WEIGHT_NEW * padSizeForAccumulation(buf.readableBytes()) +
HEADERS_WEIGHT_HISTORICAL * headersEncodedSizeAccumulator;
encodeByteBufHttpContent(state, ctx, buf, content, msg.trailingHeaders(), out);
} finally {
msg.release();
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does encodeFullHttpMessage() do?
encodeFullHttpMessage() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java.
Where is encodeFullHttpMessage() defined?
encodeFullHttpMessage() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java at line 307.
What does encodeFullHttpMessage() call?
encodeFullHttpMessage() calls 7 function(s): encodeByteBufHttpContent, encodeHeaders, encodeInitialLine, isContentAlwaysEmpty, padSizeForAccumulation, sanitizeHeadersBeforeEncode, throwUnexpectedMessageTypeEx.
What calls encodeFullHttpMessage()?
encodeFullHttpMessage() is called by 1 function(s): encode.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free