|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mina.protocol.ProtocolHandlerAdapter org.apache.mina.protocol.handler.DemuxingProtocolHandler
public class DemuxingProtocolHandler
A ProtocolHandler
that demuxes messageReceived
events
to the appropriate MessageHandler
.
You can freely register and deregister MessageHandler
s using
addMessageHandler(Class, MessageHandler)
and
removeMessageHandler(Class)
.
Constructor Summary | |
---|---|
protected |
DemuxingProtocolHandler()
Creates a new instance with no registered MessageHandler s. |
Method Summary | |
---|---|
MessageHandler |
addMessageHandler(Class type,
MessageHandler handler)
Registers a MessageHandler that receives the messages of
the specified type . |
MessageHandler |
getMessageHandler(Class type)
Returns the MessageHandler which is registered to process
the specified type . |
Map |
getMessageHandlerMap()
Returns the Map which contains all messageType-MessageHandler
pairs registered to this handler. |
void |
messageReceived(ProtocolSession session,
Object message)
Forwards the received events into the appropriate MessageHandler
which is registered by addMessageHandler(Class, MessageHandler) . |
MessageHandler |
removeMessageHandler(Class type)
Deregisters a MessageHandler that receives the messages of
the specified type . |
Methods inherited from class org.apache.mina.protocol.ProtocolHandlerAdapter |
---|
exceptionCaught, messageSent, sessionClosed, sessionCreated, sessionIdle, sessionOpened |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DemuxingProtocolHandler()
MessageHandler
s.
Method Detail |
---|
public MessageHandler addMessageHandler(Class type, MessageHandler handler)
MessageHandler
that receives the messages of
the specified type
.
public MessageHandler removeMessageHandler(Class type)
MessageHandler
that receives the messages of
the specified type
.
public MessageHandler getMessageHandler(Class type)
MessageHandler
which is registered to process
the specified type
.
public Map getMessageHandlerMap()
Map
which contains all messageType-MessageHandler
pairs registered to this handler.
public void messageReceived(ProtocolSession session, Object message) throws Exception
MessageHandler
which is registered by addMessageHandler(Class, MessageHandler)
.
messageReceived
in interface ProtocolHandler
messageReceived
in class ProtocolHandlerAdapter
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |