org.subethamail.smtp.server
Class ConnectionHandler

java.lang.Object
  extended by org.apache.mina.common.IoHandlerAdapter
      extended by org.subethamail.smtp.server.ConnectionHandler
All Implemented Interfaces:
org.apache.mina.common.IoHandler

public class ConnectionHandler
extends org.apache.mina.common.IoHandlerAdapter

The IoHandler that handles a connection. This class passes most of it's responsibilities off to the CommandHandler.

Author:
Jon Stevens This file has been used and differs from the original by the use of MINA NIO framework., De Oliveira Edouard <doe_wanted@yahoo.fr>

Nested Class Summary
 class ConnectionHandler.Context
           
 
Field Summary
protected static java.lang.String CONTEXT_ATTRIBUTE
           
 
Constructor Summary
ConnectionHandler(SMTPServer server)
           
 
Method Summary
 void exceptionCaught(org.apache.mina.common.IoSession session, java.lang.Throwable cause)
           
 int getNumberOfConnections()
           
 void messageReceived(org.apache.mina.common.IoSession session, java.lang.Object message)
           
static void sendResponse(org.apache.mina.common.IoSession session, java.lang.String response)
           
 void sessionClosed(org.apache.mina.common.IoSession session)
          Session closed.
 void sessionCreated(org.apache.mina.common.IoSession session)
           
 void sessionIdle(org.apache.mina.common.IoSession session, org.apache.mina.common.IdleStatus status)
          Sends a response telling that the session is idle and closes it.
 void setReceiveBufferSize(int receiveBufferSize)
          Sets the receive buffer size.
 
Methods inherited from class org.apache.mina.common.IoHandlerAdapter
messageSent, sessionOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_ATTRIBUTE

protected static final java.lang.String CONTEXT_ATTRIBUTE
Constructor Detail

ConnectionHandler

public ConnectionHandler(SMTPServer server)
Method Detail

getNumberOfConnections

public int getNumberOfConnections()
Returns:
The number of open connections

setReceiveBufferSize

public void setReceiveBufferSize(int receiveBufferSize)
Sets the receive buffer size.


sessionCreated

public void sessionCreated(org.apache.mina.common.IoSession session)
Specified by:
sessionCreated in interface org.apache.mina.common.IoHandler
Overrides:
sessionCreated in class org.apache.mina.common.IoHandlerAdapter

sessionClosed

public void sessionClosed(org.apache.mina.common.IoSession session)
                   throws java.lang.Exception
Session closed.

Specified by:
sessionClosed in interface org.apache.mina.common.IoHandler
Overrides:
sessionClosed in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

sessionIdle

public void sessionIdle(org.apache.mina.common.IoSession session,
                        org.apache.mina.common.IdleStatus status)
Sends a response telling that the session is idle and closes it.

Specified by:
sessionIdle in interface org.apache.mina.common.IoHandler
Overrides:
sessionIdle in class org.apache.mina.common.IoHandlerAdapter

exceptionCaught

public void exceptionCaught(org.apache.mina.common.IoSession session,
                            java.lang.Throwable cause)
Specified by:
exceptionCaught in interface org.apache.mina.common.IoHandler
Overrides:
exceptionCaught in class org.apache.mina.common.IoHandlerAdapter

messageReceived

public void messageReceived(org.apache.mina.common.IoSession session,
                            java.lang.Object message)
                     throws java.lang.Exception
Specified by:
messageReceived in interface org.apache.mina.common.IoHandler
Overrides:
messageReceived in class org.apache.mina.common.IoHandlerAdapter
Throws:
java.lang.Exception

sendResponse

public static void sendResponse(org.apache.mina.common.IoSession session,
                                java.lang.String response)
                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011 SubEthaSMTP. All Rights Reserved. Build version: UNVERSIONED