public abstract class AbstractReflectorAtmosphereHandler extends Object implements AtmosphereServletProcessor
AtmosphereHandler
that reflect every call to
Broadcaster.broadcast(java.lang.Object)
, eg sent the broadcasted event back to the remote client. All broadcasts will be by default returned
as it is to the suspended AtmosphereResponseImpl.getOutputStream()
or AtmosphereResponseImpl.getWriter()
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractReflectorAtmosphereHandler.Default
This default implementation does nothing when
AbstractReflectorAtmosphereHandler.Default.onRequest(org.atmosphere.cpr.AtmosphereResource) is called. |
Constructor and Description |
---|
AbstractReflectorAtmosphereHandler() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy this handler
|
void |
init(AtmosphereConfig config)
Initialize the
AtmosphereServletProcessor using the ServletConfig . |
void |
onStateChange(AtmosphereResourceEvent event)
Write the
AtmosphereResourceEvent.getMessage() back to the client using
the AtmosphereResponseImpl.getOutputStream() or AtmosphereResponseImpl.getWriter() . |
protected void |
postStateChange(AtmosphereResourceEvent event)
Inspect the event and decide if the underlying connection must be resumed.
|
protected boolean |
useTwoStepWrite(AtmosphereResourceEvent event) |
protected void |
write(AtmosphereResourceEvent event,
javax.servlet.ServletOutputStream o,
byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onRequest
public void onStateChange(AtmosphereResourceEvent event) throws IOException
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
event
- the AtmosphereResourceEvent.getMessage()
IOException
protected void write(AtmosphereResourceEvent event, javax.servlet.ServletOutputStream o, byte[] data) throws IOException
IOException
protected boolean useTwoStepWrite(AtmosphereResourceEvent event)
protected final void postStateChange(AtmosphereResourceEvent event)
event
- public void destroy()
AtmosphereHandler
destroy
in interface AtmosphereHandler
public void init(AtmosphereConfig config) throws javax.servlet.ServletException
AtmosphereServletProcessor
AtmosphereServletProcessor
using the ServletConfig
.init
in interface AtmosphereServletProcessor
config
- the ServletConfig
javax.servlet.ServletException
Copyright © 2016. All rights reserved.