HttpObjectAggregator Class — netty Architecture
Architecture documentation for the HttpObjectAggregator class in HttpObjectAggregator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a76e3e26_7290_bbe0_3351_75d99b1319d1["HttpObjectAggregator"] d7f816ff_e297_16ff_345a_e6fb9dee8595["HttpObjectAggregator.java"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|defined in| d7f816ff_e297_16ff_345a_e6fb9dee8595 cd55aa6f_0b34_5dea_58d6_bcffa0f1eb59["HttpObjectAggregator()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| cd55aa6f_0b34_5dea_58d6_bcffa0f1eb59 8df97396_1f19_483b_d12c_c1b8d3207d14["isStartMessage()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 8df97396_1f19_483b_d12c_c1b8d3207d14 c8974d09_dbee_c49c_f5a0_990f96ed5f35["isContentMessage()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| c8974d09_dbee_c49c_f5a0_990f96ed5f35 2f370a1f_7533_8615_9212_aaa71aba6154["isLastContentMessage()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 2f370a1f_7533_8615_9212_aaa71aba6154 0a895a60_e2a3_901a_d5ad_951134ba8394["isAggregated()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 0a895a60_e2a3_901a_d5ad_951134ba8394 d858686e_f189_b225_0770_937a272b055a["isContentLengthInvalid()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| d858686e_f189_b225_0770_937a272b055a c4eeab75_54d4_e13f_97c1_cd765960fa79["Object()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| c4eeab75_54d4_e13f_97c1_cd765960fa79 0f5437a2_41c5_c395_3825_f854f41a24ea["closeAfterContinueResponse()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 0f5437a2_41c5_c395_3825_f854f41a24ea b83263e2_08a4_0518_abd5_50bd771609d8["ignoreContentAfterContinueResponse()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| b83263e2_08a4_0518_abd5_50bd771609d8 770da0a2_17be_7e0f_3be6_42599f9a7d49["FullHttpMessage()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 770da0a2_17be_7e0f_3be6_42599f9a7d49 93433e26_bfc0_8feb_cbf0_547edf79e1bb["aggregate()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 93433e26_bfc0_8feb_cbf0_547edf79e1bb 7628a8d0_e3df_be41_eb1c_29397ff77db0["finishAggregation()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 7628a8d0_e3df_be41_eb1c_29397ff77db0 721c7154_0e41_7447_20f0_2595193fc70b["handleOversizedMessage()"] a76e3e26_7290_bbe0_3351_75d99b1319d1 -->|method| 721c7154_0e41_7447_20f0_2595193fc70b
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java lines 86–566
public class HttpObjectAggregator
extends MessageAggregator<HttpObject, HttpMessage, HttpContent, FullHttpMessage> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(HttpObjectAggregator.class);
private static final FullHttpResponse CONTINUE =
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE, Unpooled.EMPTY_BUFFER);
private static final FullHttpResponse EXPECTATION_FAILED = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.EXPECTATION_FAILED, Unpooled.EMPTY_BUFFER);
private static final FullHttpResponse TOO_LARGE_CLOSE = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, Unpooled.EMPTY_BUFFER);
private static final FullHttpResponse TOO_LARGE = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1, HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, Unpooled.EMPTY_BUFFER);
static {
EXPECTATION_FAILED.headers().set(CONTENT_LENGTH, 0);
TOO_LARGE.headers().set(CONTENT_LENGTH, 0);
TOO_LARGE_CLOSE.headers().set(CONTENT_LENGTH, 0);
TOO_LARGE_CLOSE.headers().set(CONNECTION, HttpHeaderValues.CLOSE);
}
private final boolean closeOnExpectationFailed;
/**
* Creates a new instance.
* @param maxContentLength the maximum length of the aggregated content in bytes.
* If the length of the aggregated content exceeds this value,
* {@link #handleOversizedMessage(ChannelHandlerContext, HttpMessage)} will be called.
*/
public HttpObjectAggregator(int maxContentLength) {
this(maxContentLength, false);
}
/**
* Creates a new instance.
* @param maxContentLength the maximum length of the aggregated content in bytes.
* If the length of the aggregated content exceeds this value,
* {@link #handleOversizedMessage(ChannelHandlerContext, HttpMessage)} will be called.
* @param closeOnExpectationFailed If a 100-continue response is detected but the content length is too large
* then {@code true} means close the connection. otherwise the connection will remain open and data will be
* consumed and discarded until the next request is received.
*/
public HttpObjectAggregator(int maxContentLength, boolean closeOnExpectationFailed) {
super(maxContentLength, HttpObject.class);
this.closeOnExpectationFailed = closeOnExpectationFailed;
}
@Override
protected boolean isStartMessage(HttpObject msg) throws Exception {
return msg instanceof HttpMessage;
}
@Override
protected boolean isContentMessage(HttpObject msg) throws Exception {
return msg instanceof HttpContent;
}
@Override
protected boolean isLastContentMessage(HttpContent msg) throws Exception {
return msg instanceof LastHttpContent;
}
@Override
protected boolean isAggregated(HttpObject msg) throws Exception {
return msg instanceof FullHttpMessage;
}
@Override
protected boolean isContentLengthInvalid(HttpMessage start, int maxContentLength) {
try {
return getContentLength(start, -1L) > maxContentLength;
} catch (final NumberFormatException e) {
return false;
}
}
private Object continueResponse(HttpMessage start, int maxContentLength, ChannelPipeline pipeline) {
if (HttpUtil.isUnsupportedExpectation(start)) {
// if the request contains an unsupported expectation, we return 417
pipeline.fireUserEventTriggered(HttpExpectationFailedEvent.INSTANCE);
return EXPECTATION_FAILED.retainedDuplicate();
} else if (HttpUtil.is100ContinueExpected(start)) {
Source
Frequently Asked Questions
What is the HttpObjectAggregator class?
HttpObjectAggregator is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java.
Where is HttpObjectAggregator defined?
HttpObjectAggregator is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java at line 86.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free