org.apache.mina.example.imagine.step3.server

## Class ImageServerIoHandler

- java.lang.Object
- - org.apache.mina.core.service.IoHandlerAdapter
  - - org.apache.mina.example.imagine.step3.server.ImageServerIoHandler

- All Implemented Interfaces:
    IoHandler

      public class ImageServerIoHandler
      extends IoHandlerAdapter

  server-side `IoHandler`
  Author:
    Apache MINA Project

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `INDEX_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImageServerIoHandler(MBeanServer mBeanServer)` Creates a new instance of ImageServerIoHandler.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `exceptionCaught(IoSession session, Throwable cause)` This method will be called whenever an exception occurs.
    `void` | `messageReceived(IoSession session, Object message)` Handle incoming messages.
    `void` | `sessionCreated(IoSession session)` This method is called first when a new connection to the server is made.
    `void` | `sessionOpened(IoSession session)` Called when the session is opened, which will come after the session created.

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

      `messageSent, sessionClosed, sessionIdle`

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

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

- - ### Field Detail

    - #### INDEX_KEY

          public static final String INDEX_KEY

  - ### Constructor Detail

    - #### ImageServerIoHandler

          public ImageServerIoHandler(MBeanServer mBeanServer)

      Creates a new instance of ImageServerIoHandler. For this step, we pass in a reference to the MBeanServer. This instance will be used to register new IoSession objects so that the JMX subsystem can report statistics on the sessions.
      Parameters:
        `mBeanServer` - The JMX MBeanServer that will register the sessions

  - ### Method Detail

    - #### sessionCreated

          public void sessionCreated(IoSession session)
                              throws Exception

      This method is called first when a new connection to the server is made. In here we will set up the JMX session MBean.
      Specified by:
        `sessionCreated` in interface `IoHandler`
      Overrides:
        `sessionCreated` in class `IoHandlerAdapter`
      Throws:
        `Exception`
      See Also:
        `IoHandlerAdapter.sessionCreated(org.apache.mina.core.session.IoSession)`

    - #### sessionOpened

          public void sessionOpened(IoSession session)
                             throws Exception

      Called when the session is opened, which will come after the session created.
      Specified by:
        `sessionOpened` in interface `IoHandler`
      Overrides:
        `sessionOpened` in class `IoHandlerAdapter`
      Throws:
        `Exception`
      See Also:
        `IoHandlerAdapter.sessionOpened(org.apache.mina.core.session.IoSession)`

    - #### exceptionCaught

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

      This method will be called whenever an exception occurs. For this handler, the logger will generate a warning message.
      Specified by:
        `exceptionCaught` in interface `IoHandler`
      Overrides:
        `exceptionCaught` in class `IoHandlerAdapter`
      Throws:
        `Exception`
      See Also:
        `IoHandlerAdapter.exceptionCaught(org.apache.mina.core.session.IoSession, java.lang.Throwable)`

    - #### messageReceived

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

      Handle incoming messages.
      Specified by:
        `messageReceived` in interface `IoHandler`
      Overrides:
        `messageReceived` in class `IoHandlerAdapter`
      Throws:
        `Exception`
      See Also:
        `IoHandlerAdapter.messageReceived(org.apache.mina.core.session.IoSession, java.lang.Object)`

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