org.apache.mina.example.gettingstarted.timeserver

## Class TimeServerHandler

- java.lang.Object
- - org.apache.mina.core.service.IoHandlerAdapter
  - - org.apache.mina.example.gettingstarted.timeserver.TimeServerHandler

- All Implemented Interfaces:
    IoHandler

      public class TimeServerHandler
      extends IoHandlerAdapter

  The Time Server handler : it return the current date when a message is received, or close the session if the "quit" message is received.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeServerHandler()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `exceptionCaught(IoSession session, Throwable cause)` Trap exceptions.
    `void` | `messageReceived(IoSession session, Object message)` If the message is 'quit', we exit by closing the session.
    `void` | `sessionIdle(IoSession session, IdleStatus status)` On idle, we just write a message on the console

    - ### Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter

      `messageSent, sessionClosed, sessionCreated, sessionOpened`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimeServerHandler

          public TimeServerHandler()

  - ### Method Detail

    - #### exceptionCaught

          public void exceptionCaught(IoSession session,
                             Throwable cause)
                               throws Exception

      Trap exceptions.
      Specified by:
        `exceptionCaught` in interface `IoHandler`
      Overrides:
        `exceptionCaught` in class `IoHandlerAdapter`
      Throws:
        `Exception`

    - #### messageReceived

          public void messageReceived(IoSession session,
                             Object message)
                               throws Exception

      If the message is 'quit', we exit by closing the session. Otherwise, we return the current date.
      Specified by:
        `messageReceived` in interface `IoHandler`
      Overrides:
        `messageReceived` in class `IoHandlerAdapter`
      Throws:
        `Exception`

    - #### sessionIdle

          public void sessionIdle(IoSession session,
                         IdleStatus status)
                           throws Exception

      On idle, we just write a message on the console
      Specified by:
        `sessionIdle` in interface `IoHandler`
      Overrides:
        `sessionIdle` in class `IoHandlerAdapter`
      Throws:
        `Exception`

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.