|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.netty.channel.SimpleChannelDownstreamHandler
public class SimpleChannelDownstreamHandler
A ChannelDownstreamHandler
which provides an individual handler
method for each event type. This handler down-casts the received downstream
event into more meaningful sub-type event and calls an appropriate handler
method with the down-cast event. The names of the methods starts with the
name of the operation and ends with "Requested"
(e.g. writeRequested
.)
Please use SimpleChannelHandler
if you need to implement both
ChannelUpstreamHandler
and ChannelDownstreamHandler
.
handleDownstream
method
You can override the handleDownstream
method just like overriding an ordinary Java method. Please make sure to
call super.handleDownstream()
so that other handler methods are
invoked properly:
public class MyChannelHandler extendsSimpleChannelDownstreamHandler
{@Override
public void handleDownstream(ChannelHandlerContext
ctx,ChannelEvent
e) throws Exception { // Log all channel state changes. if (e instanceofMessageEvent
) { logger.info("Writing:: " + e); } super.handleDownstream(ctx, e); } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
---|
ChannelHandler.Sharable |
Constructor Summary | |
---|---|
SimpleChannelDownstreamHandler()
Creates a new instance. |
Method Summary | |
---|---|
void |
bindRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.bind(SocketAddress) was called. |
void |
closeRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.close() was called. |
void |
connectRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.connect(SocketAddress) was called. |
void |
disconnectRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.disconnect() was called. |
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent e)
Handles the specified downstream event. |
void |
setInterestOpsRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.setInterestOps(int) was called. |
void |
unbindRequested(ChannelHandlerContext ctx,
ChannelStateEvent e)
Invoked when Channel.unbind() was called. |
void |
writeRequested(ChannelHandlerContext ctx,
MessageEvent e)
Invoked when Channel.write(Object) is called. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleChannelDownstreamHandler()
Method Detail |
---|
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception
handleDownstream
in interface ChannelDownstreamHandler
ctx
- the context object for this handlere
- the downstream event to process or intercept
Exception
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception
Channel.write(Object)
is called.
Exception
public void bindRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.bind(SocketAddress)
was called.
Exception
public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.connect(SocketAddress)
was called.
Exception
public void setInterestOpsRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.setInterestOps(int)
was called.
Exception
public void disconnectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.disconnect()
was called.
Exception
public void unbindRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.unbind()
was called.
Exception
public void closeRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
Channel.close()
was called.
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |