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 java.lang.Object implements AtmosphereServletProcessor
SimpleAtmosphereHandlerthat reflect every call toBroadcaster.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 suspendedAtmosphereResponseImpl.getOutputStream()orAtmosphereResponseImpl.getWriter().- Author:
- Jean-francois Arcand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractReflectorAtmosphereHandler.DefaultThis default implementation does nothing whenAbstractReflectorAtmosphereHandler.Default.onRequest(org.atmosphere.cpr.AtmosphereResource)is called.
-
Constructor Summary
Constructors Constructor Description AbstractReflectorAtmosphereHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy this handlervoidinit(AtmosphereConfig config)Initialize theAtmosphereServletProcessorusing theServletConfig.voidonStateChange(AtmosphereResourceEvent event)Write theAtmosphereResourceEvent.getMessage()back to the client using theAtmosphereResponseImpl.getOutputStream()orAtmosphereResponseImpl.getWriter().protected voidpostStateChange(AtmosphereResourceEvent event)Inspect the event and decide if the underlying connection must be resumed.protected booleanuseTwoStepWrite(AtmosphereResourceEvent event)protected voidwrite(AtmosphereResourceEvent event, jakarta.servlet.ServletOutputStream o, byte[] data)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.atmosphere.cpr.AtmosphereHandler
onRequest
-
-
-
-
Method Detail
-
onStateChange
public void onStateChange(AtmosphereResourceEvent event) throws java.io.IOException
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:
java.io.IOException
-
write
protected void write(AtmosphereResourceEvent event, jakarta.servlet.ServletOutputStream o, byte[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
useTwoStepWrite
protected boolean useTwoStepWrite(AtmosphereResourceEvent event)
-
postStateChange
protected final void postStateChange(AtmosphereResourceEvent event)
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
public void init(AtmosphereConfig config) throws jakarta.servlet.ServletException
Description copied from interface:AtmosphereServletProcessorInitialize theAtmosphereServletProcessorusing theServletConfig.- Specified by:
initin interfaceAtmosphereServletProcessor- Parameters:
config- theServletConfig- Throws:
jakarta.servlet.ServletException
-
-