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, AtmosphereResourceHeartbeatEventListener, AnnotatedProxy

public class ManagedAtmosphereHandler
extends AbstractReflectorAtmosphereHandler
implements AnnotatedProxy, AtmosphereResourceHeartbeatEventListener

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

Author:
Jeanfrancois

Nested Class Summary
static class ManagedAtmosphereHandler.Managed
           
static class ManagedAtmosphereHandler.MethodInfo
           
 
Nested classes/interfaces inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
AbstractReflectorAtmosphereHandler.Default
 
Constructor Summary
ManagedAtmosphereHandler()
           
 
Method Summary
 AnnotatedProxy configure(AtmosphereConfig config, Object c)
          Configure the proxy.
 void onHeartbeat(AtmosphereResourceEvent event)
           Notifies the heartbeat for the given resource to the annotated method if exists.
 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().
 boolean pathParams()
          Return true if PathParam are supported.
protected  boolean pathParams(Object o)
           
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
 
Methods inherited from interface org.atmosphere.cpr.AtmosphereHandler
destroy
 

Constructor Detail

ManagedAtmosphereHandler

public ManagedAtmosphereHandler()
Method Detail

configure

public AnnotatedProxy configure(AtmosphereConfig config,
                                Object c)
Description copied from interface: AnnotatedProxy
Configure the proxy.

Specified by:
configure in interface AnnotatedProxy
Returns:

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

pathParams

public boolean pathParams()
Description copied from interface: AnnotatedProxy
Return true if PathParam are supported.

Specified by:
pathParams in interface AnnotatedProxy
Returns:
true if PathParam are supported.

pathParams

protected boolean pathParams(Object o)

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)

onHeartbeat

public void onHeartbeat(AtmosphereResourceEvent event)

Notifies the heartbeat for the given resource to the annotated method if exists.

Specified by:
onHeartbeat in interface AtmosphereResourceHeartbeatEventListener
Parameters:
event - the event

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.