public class HttpChunkAggregator extends io.netty.handler.codec.MessageToMessageDecoder<Object,HttpMessage>
ChannelHandler that aggregates an HttpMessage
and its following HttpChunks into a single HttpMessage with
no following HttpChunks. It is useful when you don't want to take
care of HTTP messages whose transfer encoding is 'chunked'. Insert this
handler after HttpMessageDecoder in the ChannelPipeline:
ChannelPipelinep = ...; ... p.addLast("decoder", newHttpRequestDecoder()); p.addLast("aggregator", newHttpChunkAggregator(1048576)); ... p.addLast("encoder", newHttpResponseEncoder()); p.addLast("handler", new HttpRequestHandler());
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS |
| Constructor and Description |
|---|
HttpChunkAggregator(int maxContentLength)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beforeAdd(io.netty.channel.ChannelHandlerContext ctx) |
HttpMessage |
decode(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
int |
getMaxCumulationBufferComponents()
Returns the maximum number of components in the cumulation buffer.
|
boolean |
isDecodable(Object msg) |
void |
setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
Sets the maximum number of components in the cumulation buffer.
|
inboundBufferUpdated, newInboundBufferafterAdd, afterRemove, beforeRemove, channelActive, channelInactive, channelRegistered, channelUnregistered, exceptionCaught, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
public HttpChunkAggregator(int maxContentLength)
maxContentLength - the maximum length of the aggregated content.
If the length of the aggregated content exceeds this value,
a TooLongFrameException will be raised.public final int getMaxCumulationBufferComponents()
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS.public final void setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
and its minimum allowed value is 2.public boolean isDecodable(Object msg) throws Exception
isDecodable in class io.netty.handler.codec.MessageToMessageDecoder<Object,HttpMessage>Exceptionpublic HttpMessage decode(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
decode in class io.netty.handler.codec.MessageToMessageDecoder<Object,HttpMessage>ExceptionCopyright © 2008-2012 The Netty Project. All Rights Reserved.