|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.handler.AbstractReflectorAtmosphereHandler
org.atmosphere.handler.OnMessage<T>
public abstract class OnMessage<T>
Simple AtmosphereHandler that must be used with the AtmosphereResourceLifecycleInterceptor
and BroadcastOnPostAtmosphereInterceptor to reduce the handling of the suspend/resume/disconnect and
broadcast operation.
BroadcasterCache.
method
| Field Summary | |
|---|---|
static String |
MESSAGE_DELIMITER
|
| Constructor Summary | |
|---|---|
OnMessage()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Destroy this handler |
void |
onDisconnect(AtmosphereResponse response)
This method will be invoked when the underlying WebServer detects a connection has been closed. |
abstract void |
onMessage(AtmosphereResponse response,
T message)
Implement this method to get invoked every time a new Broadcaster.broadcast(Object)
occurs. |
void |
onOpen(AtmosphereResource resource)
This method will be invoked when an connection has been received and not haven't yet be suspended. |
void |
onRequest(AtmosphereResource resource)
When a client send 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 |
onResume(AtmosphereResponse response)
This method will be invoked during the process of resuming a connection. |
void |
onStateChange(AtmosphereResourceEvent event)
Write the AtmosphereResourceEvent.getMessage() back to the client using
the AtmosphereResponse.getOutputStream() or AtmosphereResponse.getWriter(). |
void |
onTimeout(AtmosphereResponse response)
This method will be invoked when a suspended connection times out, e.g no activity has occurred for the specified time used when suspending. |
| Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler |
|---|
postStateChange |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MESSAGE_DELIMITER
| Constructor Detail |
|---|
public OnMessage()
| Method Detail |
|---|
public final void onRequest(AtmosphereResource resource)
throws IOException
AtmosphereHandlerAtmosphereHandler, it can decide
if the underlying connection can be suspended (creating a Continuation)
or handle the connection synchronously.
It is recommended to only suspend request for which HTTP method is a GET
and use the POST method to send data to the server, without marking the
connection as asynchronous.
resource - an AtmosphereResource
IOException
public final void onStateChange(AtmosphereResourceEvent event)
throws IOException
AbstractReflectorAtmosphereHandlerAtmosphereResourceEvent.getMessage() back to the client using
the AtmosphereResponse.getOutputStream() or AtmosphereResponse.getWriter().
If a Serializer is defined, it will be invoked and the writ operation
will be delegated to to it.
By default, this method will try to use AtmosphereResponse.getWriter().
onStateChange in interface AtmosphereHandleronStateChange in class AbstractReflectorAtmosphereHandlerevent - the AtmosphereResourceEvent.getMessage()
IOExceptionpublic final void destroy()
AtmosphereHandler
public void onOpen(AtmosphereResource resource)
throws IOException
AtmosphereResourceLifecycleInterceptor
resource - an AtmosphereResource
IOException
public abstract void onMessage(AtmosphereResponse response,
T message)
throws IOException
Broadcaster.broadcast(Object)
occurs.
response - an AtmosphereResponsemessage - a message of type T
IOException
public void onResume(AtmosphereResponse response)
throws IOException
response - an AtmosphereResponse.
IOException
public void onTimeout(AtmosphereResponse response)
throws IOException
response - an AtmosphereResponse.
IOException
public void onDisconnect(AtmosphereResponse response)
throws IOException
response - an AtmosphereResponse.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||