public class ManagedAtmosphereHandler extends AbstractReflectorAtmosphereHandler implements AnnotatedProxy, AtmosphereResourceHeartbeatEventListener
AtmosphereHandler
that implement support for Atmosphere 2.0 annotations.Modifier and Type | Class and Description |
---|---|
static class |
ManagedAtmosphereHandler.Managed |
static class |
ManagedAtmosphereHandler.MethodInfo |
AbstractReflectorAtmosphereHandler.Default
Modifier and Type | Field and Description |
---|---|
protected List<ManagedAtmosphereHandler.MethodInfo> |
onRuntimeMethod |
protected boolean |
pathParams |
protected AtmosphereResourceFactory |
resourcesFactory |
Constructor and Description |
---|
ManagedAtmosphereHandler() |
Modifier and Type | Method and Description |
---|---|
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 AtmosphereResponseImpl.getOutputStream() or AtmosphereResponseImpl.getWriter() . |
boolean |
pathParams()
Return true if
PathParam are supported. |
protected boolean |
pathParams(Object o) |
protected Method |
populate(Object c,
Class<? extends Annotation> annotation) |
protected List<ManagedAtmosphereHandler.MethodInfo> |
populateMessage(Object c,
Class<? extends Annotation> annotation) |
protected void |
processReady(AtmosphereResource r) |
Object |
target()
The Object the
AtmosphereHandler is proxying. |
String |
toString() |
destroy, init, postStateChange, useTwoStepWrite, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
destroy
protected List<ManagedAtmosphereHandler.MethodInfo> onRuntimeMethod
protected boolean pathParams
protected AtmosphereResourceFactory resourcesFactory
public AnnotatedProxy configure(AtmosphereConfig config, Object c)
AnnotatedProxy
configure
in interface AnnotatedProxy
public void onRequest(AtmosphereResource resource) throws IOException
AtmosphereHandler
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.onRequest
in interface AtmosphereHandler
resource
- an AtmosphereResource
IOException
public void onStateChange(AtmosphereResourceEvent event) throws IOException
AbstractReflectorAtmosphereHandler
AtmosphereResourceEvent.getMessage()
back to the client using
the AtmosphereResponseImpl.getOutputStream()
or AtmosphereResponseImpl.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 AtmosphereResponseImpl.getWriter()
.onStateChange
in interface AtmosphereHandler
onStateChange
in class AbstractReflectorAtmosphereHandler
event
- the AtmosphereResourceEvent.getMessage()
IOException
public boolean pathParams()
AnnotatedProxy
PathParam
are supported.pathParams
in interface AnnotatedProxy
PathParam
are supported.protected boolean pathParams(Object o)
protected Method populate(Object c, Class<? extends Annotation> annotation)
protected List<ManagedAtmosphereHandler.MethodInfo> populateMessage(Object c, Class<? extends Annotation> annotation)
public Object target()
AnnotatedProxy
AtmosphereHandler
is proxying.target
in interface AnnotatedProxy
protected void processReady(AtmosphereResource r)
public void onHeartbeat(AtmosphereResourceEvent event)
Notifies the heartbeat for the given resource to the annotated method if exists.
onHeartbeat
in interface AtmosphereResourceHeartbeatEventListener
event
- the eventCopyright © 2016. All rights reserved.