com.mooapi.server.protocol.sniffer
Class SniffFilter

java.lang.Object
  extended by org.apache.mina.common.IoFilterAdapter
      extended by com.mooapi.server.protocol.sniffer.SniffFilter
All Implemented Interfaces:
org.apache.mina.common.IoFilter

public class SniffFilter
extends org.apache.mina.common.IoFilterAdapter

A protocol sniffer for debugging purposes.

Author:
Steve Taylor

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilter
org.apache.mina.common.IoFilter.NextFilter, org.apache.mina.common.IoFilter.WriteRequest
 
Constructor Summary
SniffFilter()
           
 
Method Summary
 void filterWrite(org.apache.mina.common.IoFilter.NextFilter nextFilter, org.apache.mina.common.IoSession session, org.apache.mina.common.IoFilter.WriteRequest request)
          Pass the unmodified contents through to the next filter.
static java.lang.String getConnectionName(org.apache.mina.common.IoSession session)
          Get the name of the connection associated with the specified MINA connection.
 void messageReceived(org.apache.mina.common.IoFilter.NextFilter nextFilter, org.apache.mina.common.IoSession session, java.lang.Object msg)
          Print the received message to standard output.
 void messageSent(org.apache.mina.common.IoFilter.NextFilter nextFilter, org.apache.mina.common.IoSession session, java.lang.Object msg)
          Print the sent message to standard output.
 void setDebug(boolean debug)
          Set the debugging status.
 
Methods inherited from class org.apache.mina.common.IoFilterAdapter
destroy, exceptionCaught, filterClose, init, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SniffFilter

public SniffFilter()
Method Detail

setDebug

public void setDebug(boolean debug)
Set the debugging status.

Parameters:
debug - The debugging status.

messageReceived

public void messageReceived(org.apache.mina.common.IoFilter.NextFilter nextFilter,
                            org.apache.mina.common.IoSession session,
                            java.lang.Object msg)
                     throws java.lang.Exception
Print the received message to standard output.

Specified by:
messageReceived in interface org.apache.mina.common.IoFilter
Overrides:
messageReceived in class org.apache.mina.common.IoFilterAdapter
Parameters:
nextFilter -
session -
msg -
Throws:
java.lang.Exception

messageSent

public void messageSent(org.apache.mina.common.IoFilter.NextFilter nextFilter,
                        org.apache.mina.common.IoSession session,
                        java.lang.Object msg)
                 throws java.lang.Exception
Print the sent message to standard output.

Specified by:
messageSent in interface org.apache.mina.common.IoFilter
Overrides:
messageSent in class org.apache.mina.common.IoFilterAdapter
Parameters:
nextFilter -
session -
msg -
Throws:
java.lang.Exception

filterWrite

public void filterWrite(org.apache.mina.common.IoFilter.NextFilter nextFilter,
                        org.apache.mina.common.IoSession session,
                        org.apache.mina.common.IoFilter.WriteRequest request)
                 throws java.lang.Exception
Pass the unmodified contents through to the next filter.

Specified by:
filterWrite in interface org.apache.mina.common.IoFilter
Overrides:
filterWrite in class org.apache.mina.common.IoFilterAdapter
Parameters:
nextFilter - The next filter in the chain.
session - The MINA connection.
request - The write request.
Throws:
java.lang.Exception

getConnectionName

public static java.lang.String getConnectionName(org.apache.mina.common.IoSession session)
Get the name of the connection associated with the specified MINA connection.

Parameters:
session - A MINA connection.
Returns:
The associated connection name.


Copyright © 2009. All Rights Reserved.