Package org.atmosphere.config.managed
Class ManagedAtmosphereHandler
- java.lang.Object
-
- org.atmosphere.handler.AbstractReflectorAtmosphereHandler
-
- org.atmosphere.config.managed.ManagedAtmosphereHandler
-
- All Implemented Interfaces:
AtmosphereHandler,AtmosphereResourceHeartbeatEventListener,AtmosphereServletProcessor,AnnotatedProxy
public class ManagedAtmosphereHandler extends AbstractReflectorAtmosphereHandler implements AnnotatedProxy, AtmosphereResourceHeartbeatEventListener
An internal implementation ofAtmosphereHandlerthat implement support for Atmosphere 2.0 annotations.- Author:
- Jeanfrancois
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classManagedAtmosphereHandler.Managedstatic classManagedAtmosphereHandler.MethodInfo-
Nested classes/interfaces inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
AbstractReflectorAtmosphereHandler.Default
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<ManagedAtmosphereHandler.MethodInfo>onRuntimeMethodprotected booleanpathParamsprotected AtmosphereResourceFactoryresourcesFactory
-
Constructor Summary
Constructors Constructor Description ManagedAtmosphereHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotatedProxyconfigure(AtmosphereConfig config, java.lang.Object c)Configure the proxy.voidonHeartbeat(AtmosphereResourceEvent event)Notifies the heartbeat for the given resource to the annotated method if exists.voidonRequest(AtmosphereResource resource)When a client sends a request to its associatedAtmosphereHandler, it can decide if the underlying connection can be suspended (creating a Continuation) or handle the connection synchronously.voidonStateChange(AtmosphereResourceEvent event)Write theAtmosphereResourceEvent.getMessage()back to the client using theAtmosphereResponseImpl.getOutputStream()orAtmosphereResponseImpl.getWriter().booleanpathParams()Return true ifPathParamare supported.protected booleanpathParams(java.lang.Object o)protected java.lang.reflect.Methodpopulate(java.lang.Object c, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)protected java.util.List<ManagedAtmosphereHandler.MethodInfo>populateMessage(java.lang.Object c)protected voidprocessReady(AtmosphereResource r)java.lang.Objecttarget()The Object theAtmosphereHandleris proxying.java.lang.StringtoString()-
Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
destroy, init, postStateChange, useTwoStepWrite, write
-
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
-
-
-
-
Field Detail
-
onRuntimeMethod
protected java.util.List<ManagedAtmosphereHandler.MethodInfo> onRuntimeMethod
-
pathParams
protected boolean pathParams
-
resourcesFactory
protected AtmosphereResourceFactory resourcesFactory
-
-
Method Detail
-
configure
public AnnotatedProxy configure(AtmosphereConfig config, java.lang.Object c)
Description copied from interface:AnnotatedProxyConfigure the proxy.- Specified by:
configurein interfaceAnnotatedProxy- Returns:
-
onRequest
public void onRequest(AtmosphereResource resource) throws java.io.IOException
Description copied from interface:AtmosphereHandlerWhen a client sends a request to its associatedAtmosphereHandler, 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:
onRequestin interfaceAtmosphereHandler- Parameters:
resource- anAtmosphereResource- Throws:
java.io.IOException
-
onStateChange
public void onStateChange(AtmosphereResourceEvent event) throws java.io.IOException
Description copied from class:AbstractReflectorAtmosphereHandlerWrite theAtmosphereResourceEvent.getMessage()back to the client using theAtmosphereResponseImpl.getOutputStream()orAtmosphereResponseImpl.getWriter(). If aSerializeris defined, it will be invoked and the write operation will be delegated to it. By default, this method will try to useAtmosphereResponseImpl.getWriter().- Specified by:
onStateChangein interfaceAtmosphereHandler- Overrides:
onStateChangein classAbstractReflectorAtmosphereHandler- Parameters:
event- theAtmosphereResourceEvent.getMessage()- Throws:
java.io.IOException
-
pathParams
public boolean pathParams()
Description copied from interface:AnnotatedProxyReturn true ifPathParamare supported.- Specified by:
pathParamsin interfaceAnnotatedProxy- Returns:
- true if
PathParamare supported.
-
pathParams
protected boolean pathParams(java.lang.Object o)
-
populate
protected java.lang.reflect.Method populate(java.lang.Object c, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
-
populateMessage
protected java.util.List<ManagedAtmosphereHandler.MethodInfo> populateMessage(java.lang.Object c)
-
target
public java.lang.Object target()
Description copied from interface:AnnotatedProxyThe Object theAtmosphereHandleris proxying.- Specified by:
targetin interfaceAnnotatedProxy- 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:
onHeartbeatin interfaceAtmosphereResourceHeartbeatEventListener- Parameters:
event- the event
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-