org.atmosphere.config.managed
Class ManagedAtmosphereHandler

java.lang.Object
  extended by org.atmosphere.handler.AbstractReflectorAtmosphereHandler
      extended by org.atmosphere.config.managed.ManagedAtmosphereHandler
All Implemented Interfaces:
AtmosphereHandler, AnnotatedProxy

public class ManagedAtmosphereHandler
extends AbstractReflectorAtmosphereHandler
implements AnnotatedProxy

An internal implementation of AtmosphereHandler that implement support for Atmosphere 2.0 annotations.

Author:
Jeanfrancois

Constructor Summary
ManagedAtmosphereHandler(Object c)
           
 
Method Summary
 Object invoke(AtmosphereResource resource, Object msg)
           
protected  Class<?> loadClass(String className)
           
 void onRequest(AtmosphereResource resource)
          When a client sends a request to its associated AtmosphereHandler, it can decide if the underlying connection can be suspended (creating a Continuation) or handle the connection synchronously.
 void onStateChange(AtmosphereResourceEvent event)
          Write the AtmosphereResourceEvent.getMessage() back to the client using the AtmosphereResponse.getOutputStream() or AtmosphereResponse.getWriter().
protected  void processReady(AtmosphereResource r)
           
 Object target()
          The Object the AtmosphereHandler is proxying.
 String toString()
           
 
Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
destroy, postStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedAtmosphereHandler

public ManagedAtmosphereHandler(Object c)
Method Detail

onRequest

public void onRequest(AtmosphereResource resource)
               throws IOException
Description copied from interface: AtmosphereHandler
When a client sends a request to its associated AtmosphereHandler, it can decide if the underlying connection can be suspended (creating a Continuation) or handle the connection synchronously.

It is recommended to only suspend requests for which HTTP method is a GET and use the POST method to send data to the server, without marking the connection as asynchronous.

Specified by:
onRequest in interface AtmosphereHandler
Parameters:
resource - an AtmosphereResource
Throws:
IOException

onStateChange

public void onStateChange(AtmosphereResourceEvent event)
                   throws IOException
Description copied from class: AbstractReflectorAtmosphereHandler
Write the AtmosphereResourceEvent.getMessage() back to the client using the AtmosphereResponse.getOutputStream() or AtmosphereResponse.getWriter(). If a Serializer is defined, it will be invoked and the write operation will be delegated to it.

By default, this method will try to use AtmosphereResponse.getWriter().

Specified by:
onStateChange in interface AtmosphereHandler
Overrides:
onStateChange in class AbstractReflectorAtmosphereHandler
Parameters:
event - the AtmosphereResourceEvent.getMessage()
Throws:
IOException

invoke

public Object invoke(AtmosphereResource resource,
                     Object msg)
              throws IOException
Throws:
IOException

loadClass

protected Class<?> loadClass(String className)
                      throws Exception
Throws:
Exception

target

public Object target()
Description copied from interface: AnnotatedProxy
The Object the AtmosphereHandler is proxying.

Specified by:
target in interface AnnotatedProxy
Returns:

processReady

protected void processReady(AtmosphereResource r)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.