Interface ChannelHandler

All Known Subinterfaces:
ChannelDownstreamHandler, ChannelUpstreamHandler, LifeCycleAwareChannelHandler
All Known Implementing Classes:
Base64Decoder, Base64Encoder, ChunkedWriteHandler, CompatibleObjectDecoder, CompatibleObjectEncoder, DelimiterBasedFrameDecoder, ExecutionHandler, FixedLengthFrameDecoder, FrameDecoder, HttpChunkAggregator, HttpMessageDecoder, HttpMessageEncoder, HttpRequestDecoder, HttpRequestEncoder, HttpResponseDecoder, HttpResponseEncoder, IdleStateAwareChannelHandler, IdleStateAwareChannelUpstreamHandler, IdleStateHandler, LengthFieldBasedFrameDecoder, LengthFieldPrepender, LoggingHandler, ObjectDecoder, ObjectEncoder, OneToOneDecoder, OneToOneEncoder, ProtobufDecoder, ProtobufEncoder, ReadTimeoutHandler, ReplayingDecoder, SimpleChannelDownstreamHandler, SimpleChannelHandler, SimpleChannelUpstreamHandler, SslHandler, StringDecoder, StringEncoder, WriteTimeoutHandler

public interface ChannelHandler

Handles or intercepts a ChannelEvent, and sends a ChannelEvent to the next handler in a ChannelPipeline.


ChannelHandler itself does not provide any method. To handle a ChannelEvent you need to implement its sub-interfaces. There are two sub-interfaces which handles a received event, one for upstream events and the other for downstream events:

You will also find more detailed explanation from the documentation of each sub-interface on how an event is interpreted when it goes upstream and downstream respectively.

The context object

A ChannelHandler is provided with a ChannelHandlerContext object. A ChannelHandler is supposed to interact with the ChannelPipeline it belongs to via a context object. Using the context object, the ChannelHandler can pass events upstream or downstream, modify the behavior of the pipeline, or store the information (attachment) which is specific to the handler.

Additional resources worth reading

Please refer to the ChannelEvent and ChannelPipeline to find out what a upstream event and a downstream event are, what fundamental differences they have, and how they flow in a pipeline.

$Rev: 1706 $, $Date: 2009-09-03 13:33:15 +0900 (목, 03 9 2009) $
The Netty Project (, Trustin Lee (

Copyright © 2008-2009 JBoss, by Red Hat. All Rights Reserved.