org.jboss.netty.handler.codec.http
Class HttpChunkAggregator

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelUpstreamHandler
      extended by org.jboss.netty.handler.codec.http.HttpChunkAggregator
All Implemented Interfaces:
ChannelHandler, ChannelUpstreamHandler

public class HttpChunkAggregator
extends SimpleChannelUpstreamHandler

A 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:

 ChannelPipeline p = ...;
 ...
 p.addLast("decoder", new HttpRequestDecoder());
 p.addLast("aggregator", new HttpChunkAggregator(1048576));
 ...
 p.addLast("encoder", new HttpResponseEncoder());
 p.addLast("handler", new HttpRequestHandler());
 

Version:
$Rev: 2370 $, $Date: 2010-10-19 14:40:44 +0900 (Tue, 19 Oct 2010) $
Author:
The Netty Project, Trustin Lee

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
 
Constructor Summary
HttpChunkAggregator(int maxContentLength)
          Creates a new instance.
 
Method Summary
 void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
          Invoked when a message object (e.g: ChannelBuffer) was received from a remote peer.
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, exceptionCaught, handleUpstream, writeComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpChunkAggregator

public HttpChunkAggregator(int maxContentLength)
Creates a new instance.

Parameters:
maxContentLength - the maximum length of the aggregated content. If the length of the aggregated content exceeds this value, a TooLongFrameException will be raised.
Method Detail

messageReceived

public void messageReceived(ChannelHandlerContext ctx,
                            MessageEvent e)
                     throws Exception
Description copied from class: SimpleChannelUpstreamHandler
Invoked when a message object (e.g: ChannelBuffer) was received from a remote peer.

Overrides:
messageReceived in class SimpleChannelUpstreamHandler
Throws:
Exception


Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.