Class AtmosphereResourceLifecycleInterceptor
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware
This AtmosphereInterceptor implementation automatically suspends the intercepted
AtmosphereResource and takes care of managing the response's state (flushing, resuming,
etc.) when a Broadcaster.broadcast(java.lang.Object) is invoked. When used, AtmosphereHandler implementations no longer need to make calls to
AtmosphereResource.suspend().
Broadcaster, this interceptor will not work and you need to programmatically
resume, flush, etc.
By default, intercepted AtmosphereResource instances are suspended when a GET
request is received. You can change the triggering http method by configuring
ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHOD
Use this class when you don't want to manage the suspend/resume operation from your
particular Atmosphere framework implementation classes (AtmosphereHandler,
WebSocketHandler, or
Meteor instances) or extensions (GWT, Jersey, Wicket, etc...)
HeaderConfig.X_ATMOSPHERE_TRANSPORT header. Your AtmosphereHandler must also extends the
AbstractReflectorAtmosphereHandler or implements the logic defined inside
AbstractReflectorAtmosphereHandler.postStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) - Author:
- Jeanfrancois Arcand
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.voiddestroy()Clean the AtmosphereInterceptor when removed or when the Atmosphere is undeployed.Automatically suspend theAtmosphereResourcebased onAtmosphereResource.TRANSPORTvalue.method()voidInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.inttimeoutInSeconds(int timeoutInSeconds) toString()
-
Constructor Details
-
AtmosphereResourceLifecycleInterceptor
public AtmosphereResourceLifecycleInterceptor() -
AtmosphereResourceLifecycleInterceptor
public AtmosphereResourceLifecycleInterceptor(boolean force)
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
method
-
timeoutInSeconds
public int timeoutInSeconds() -
method
-
timeoutInSeconds
-
inspect
Automatically suspend theAtmosphereResourcebased onAtmosphereResource.TRANSPORTvalue.- Specified by:
inspectin interfaceAtmosphereInterceptor- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUE
-
postInspect
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
-
toString
-