diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java index 5cfad30982..908ac8d12b 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java @@ -37,18 +37,50 @@ import static io.netty.handler.codec.http.HttpUtil.getContentLength; * or {@link FullHttpResponse} (depending on if it used to handle requests or responses) * with no following {@link HttpContent}s. It is useful when you don't want to take * care of HTTP messages whose transfer encoding is 'chunked'. Insert this - * handler after {@link HttpObjectDecoder} in the {@link ChannelPipeline}: - *
- * {@link ChannelPipeline} p = ...; - * ... - * p.addLast("encoder", new {@link HttpResponseEncoder}()); - * p.addLast("decoder", new {@link HttpRequestDecoder}()); - * p.addLast("aggregator", new {@link HttpObjectAggregator}(1048576)); - * ... - * p.addLast("handler", new HttpRequestHandler()); - *- * Be aware that you need to have the {@link HttpResponseEncoder} or {@link HttpRequestEncoder} - * before the {@link HttpObjectAggregator} in the {@link ChannelPipeline}. + * handler after {@link HttpResponseDecoder} in the {@link ChannelPipeline} if being used to handle + * responses, or after {@link HttpRequestDecoder} and {@link HttpResponseEncoder} in the + * {@link ChannelPipeline} if being used to handle requests. + *
+ *+ *+ * {@link ChannelPipeline} p = ...; + * ... + * p.addLast("decoder", new {@link HttpRequestDecoder}()); + * p.addLast("encoder", new {@link HttpResponseEncoder}()); + * p.addLast("aggregator", new {@link HttpObjectAggregator}(1048576)); + * ... + * p.addLast("handler", new HttpRequestHandler()); + *+ *
+ * For convenience, consider putting a {@link HttpServerCodec} before the {@link HttpObjectAggregator} + * as it functions as both a {@link HttpRequestDecoder} and a {@link HttpResponseEncoder}. + *
+ * Be aware that {@link HttpObjectAggregator} may end up sending a {@link HttpResponse}: + *Response Status | + *Condition When Sent | + *
---|---|
100 Continue | + *A '100-continue' expectation is received and the 'content-length' doesn't exceed maxContentLength | + *
417 Expectation Failed | + *A '100-continue' expectation is received and the 'content-length' exceeds maxContentLength | + *
413 Request Entity Too Large | + *Either the 'content-length' or the bytes received so far exceed maxContentLength | + *