Class HttpObjectAggregator

All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
Direct Known Subclasses:
HttpClientUpgradeHandler, HttpServerUpgradeHandler

public class HttpObjectAggregator extends MessageAggregator<HttpObject,HttpMessage,HttpContent,FullHttpMessage>
A ChannelHandler that aggregates an HttpMessage and its following HttpContents into a single FullHttpRequest or FullHttpResponse (depending on if it used to handle requests or responses) with no following HttpContents. It is useful when you don't want to take care of HTTP messages whose transfer encoding is 'chunked'. Insert this handler after HttpResponseDecoder in the ChannelPipeline if being used to handle responses, or after HttpRequestDecoder and HttpResponseEncoder in the ChannelPipeline if being used to handle requests.
  ChannelPipeline p = ...;
  ...
  p.addLast("decoder", new HttpRequestDecoder());
  p.addLast("encoder", new HttpResponseEncoder());
  p.addLast("aggregator", new HttpObjectAggregator(1048576));
  ...
  p.addLast("handler", new HttpRequestHandler());
  

For convenience, consider putting a HttpServerCodec before the HttpObjectAggregator as it functions as both a HttpRequestDecoder and a HttpResponseEncoder.

Be aware that HttpObjectAggregator may end up sending a 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
See Also: