Package org.atmosphere.handler
Class AbstractReflectorAtmosphereHandler
java.lang.Object
org.atmosphere.handler.AbstractReflectorAtmosphereHandler
- All Implemented Interfaces:
AtmosphereHandler,AtmosphereServletProcessor
- Direct Known Subclasses:
AbstractReflectorAtmosphereHandler.Default,ManagedAtmosphereHandler,OnMessage,ReflectorServletProcessor
public abstract class AbstractReflectorAtmosphereHandler
extends Object
implements AtmosphereServletProcessor
Simple
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().- Author:
- Jean-francois Arcand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis default implementation does nothing whenAbstractReflectorAtmosphereHandler.Default.onRequest(org.atmosphere.cpr.AtmosphereResource)is called. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy this handlervoidinit(AtmosphereConfig config) Initialize theAtmosphereServletProcessorusing theServletConfig.voidWrite theAtmosphereResourceEvent.getMessage()back to the client using theAtmosphereResponseImpl.getOutputStream()orAtmosphereResponseImpl.getWriter().protected final voidInspect the event and decide if the underlying connection must be resumed.protected booleanprotected voidwrite(AtmosphereResourceEvent event, javax.servlet.ServletOutputStream o, byte[] data) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.atmosphere.cpr.AtmosphereHandler
onRequest
-
Constructor Details
-
AbstractReflectorAtmosphereHandler
public AbstractReflectorAtmosphereHandler()
-
-
Method Details
-
onStateChange
Write 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- Parameters:
event- theAtmosphereResourceEvent.getMessage()- Throws:
IOException
-
write
protected void write(AtmosphereResourceEvent event, javax.servlet.ServletOutputStream o, byte[] data) throws IOException - Throws:
IOException
-
useTwoStepWrite
-
postStateChange
Inspect the event and decide if the underlying connection must be resumed.- Parameters:
event- AtmosphereResourceEvent
-
destroy
public void destroy()Description copied from interface:AtmosphereHandlerDestroy this handler- Specified by:
destroyin interfaceAtmosphereHandler
-
init
Description copied from interface:AtmosphereServletProcessorInitialize theAtmosphereServletProcessorusing theServletConfig.- Specified by:
initin interfaceAtmosphereServletProcessor- Parameters:
config- theServletConfig- Throws:
javax.servlet.ServletException
-