Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.netty.channel
Interface ChannelDownstreamHandler

All Superinterfaces:
  ChannelHandler

All Known Implementing Classes:
  Base64Encoder, BufferedWriteHandler, ChunkedWriteHandler, CompatibleObjectEncoder, ExecutionHandler, HttpClientCodec, HttpContentCompressor, HttpContentEncoder, HttpMessageEncoder, HttpRequestEncoder, HttpResponseEncoder, HttpServerCodec, IdleStateAwareChannelHandler, LengthFieldPrepender, LoggingHandler, ObjectEncoder, OneToOneEncoder, ProtobufEncoder, ProtobufVarint32LengthFieldPrepender, RtspMessageEncoder, RtspRequestEncoder, RtspResponseEncoder, SimpleChannelDownstreamHandler, SimpleChannelHandler, SslHandler, StringEncoder, WebSocketFrameEncoder, WriteTimeoutHandler, ZlibEncoder

    public interface ChannelDownstreamHandler

extends ChannelHandler

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

The most common use case of this interface is to intercept an I/O request such as `Channel.write(Object)` and `Channel.close()`.

### `SimpleChannelDownstreamHandler`

In most cases, you will get to use a `SimpleChannelDownstreamHandler` to implement a downstream handler because it provides an individual handler method for each event type. You might want to implement this interface directly though if you want to handle various types of events in more generic way.

### Firing an event to the next handler

You can forward the received event downstream or upstream. In most cases, `ChannelDownstreamHandler` will send the event downstream (i.e. outbound) although it is legal to send the event upstream (i.e. inbound):

     // Sending the event downstream (outbound)
     void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
         ...
         ctx.sendDownstream(e);
         ...
     }

     // Sending the event upstream (inbound)
     void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
         ...
         ctx.sendUpstream(new UpstreamChannelStateEvent(...));
         ...
     }

#### Using the helper class to send an event

You will also find various helper methods in `Channels` to be useful to generate and send an artificial or manipulated event.

### State management

Please refer to `ChannelHandler`.

### Thread safety

`handleDownstream` may be invoked by more than one thread simultaneously. If the handler accesses a shared resource or stores stateful information, you might need proper synchronization in the handler implementation.

Version:
  $Rev: 2122 $, $Date: 2010-02-02 11:00:04 +0900 (Tue, 02 Feb 2010) $
Author:
  The Netty Project, Trustin Lee

Nested Class Summary

Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
`ChannelHandler.Sharable`

Method Summary
`void` | `handleDownstream(ChannelHandlerContext ctx, ChannelEvent e)` Handles the specified downstream event.

Method Detail

### handleDownstream

    void handleDownstream(ChannelHandlerContext ctx,
                          ChannelEvent e)
                          throws Exception

  Handles the specified downstream event.

  Parameters:
    `ctx` - the context object for this handler
    `e` - the downstream event to process or intercept
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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