Package org.atmosphere.interceptor
Class AtmosphereResourceStateRecovery
- java.lang.Object
-
- org.atmosphere.interceptor.AtmosphereResourceStateRecovery
-
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware
public class AtmosphereResourceStateRecovery extends java.lang.Object implements AtmosphereInterceptor
This interceptor associates aAtmosphereResourceto allBroadcasterthe resource was added before the underlying connection got closed and resume. This allow an application to restore the state of the client before the disconnection occurred, and for the long-polling transport to return to it's previous state.- Author:
- Jeanfrancois Arcand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAtmosphereResourceStateRecovery.Bstatic classAtmosphereResourceStateRecovery.BroadcasterTrackerstatic classAtmosphereResourceStateRecovery.OnAlwaysSuspend
-
Constructor Summary
Constructors Constructor Description AtmosphereResourceStateRecovery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(AtmosphereConfig config)Configure an AtmosphereFramework object.voiddestroy()Clean the AtmosphereInterceptor when removed or when the Atmosphere is undeployed.Actioninspect(AtmosphereResource r)Invoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.voidpostInspect(AtmosphereResource r)Invoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.java.util.List<java.lang.Object>retrieveCache(AtmosphereResource r, AtmosphereResourceStateRecovery.BroadcasterTracker tracker, boolean force)protected voidstartStateTracker()java.util.concurrent.ConcurrentHashMap<java.lang.String,AtmosphereResourceStateRecovery.BroadcasterTracker>states()longtimeout()AtmosphereResourceStateRecoverytimeout(long timeout)java.lang.StringtoString()
-
-
-
Method Detail
-
configure
public void configure(AtmosphereConfig config)
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
timeout
public AtmosphereResourceStateRecovery timeout(long timeout)
-
timeout
public long timeout()
-
startStateTracker
protected void startStateTracker()
-
inspect
public Action inspect(AtmosphereResource r)
Description copied from interface:AtmosphereInterceptorInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
inspectin interfaceAtmosphereInterceptor- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUEorAction.SUSPENDto dispatch theAtmosphereResourceto otherAtmosphereInterceptororAtmosphereHandler. ReturnAction.TYPE.CANCELLEDto stop the processing.
-
postInspect
public void postInspect(AtmosphereResource r)
Description copied from interface:AtmosphereInterceptorInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
postInspectin interfaceAtmosphereInterceptor- Parameters:
r- aAtmosphereResource
-
destroy
public void destroy()
Description copied from interface:AtmosphereInterceptorClean the AtmosphereInterceptor when removed or when the Atmosphere is undeployed.- Specified by:
destroyin interfaceAtmosphereInterceptor
-
states
public java.util.concurrent.ConcurrentHashMap<java.lang.String,AtmosphereResourceStateRecovery.BroadcasterTracker> states()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
retrieveCache
public java.util.List<java.lang.Object> retrieveCache(AtmosphereResource r, AtmosphereResourceStateRecovery.BroadcasterTracker tracker, boolean force)
-
-