Class AtmosphereResourceLifecycleInterceptor
- java.lang.Object
-
- org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor
-
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware
public class AtmosphereResourceLifecycleInterceptor extends java.lang.Object implements AtmosphereInterceptor
This
If your application doesn't useAtmosphereInterceptorimplementation automatically suspends the interceptedAtmosphereResourceand takes care of managing the response's state (flushing, resuming, etc.) when aBroadcaster.broadcast(java.lang.Object)is invoked. When used,AtmosphereHandlerimplementations no longer need to make calls toAtmosphereResource.suspend().Broadcaster, this interceptor will not work and you need to programmatically resume, flush, etc.By default, intercepted
AtmosphereResourceinstances are suspended when a GET request is received. You can change the triggering http method by configuringApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHODUse this class when you don't want to manage the suspend/resume operation from your particular Atmosphere framework implementation classes (
For this mechanism to work properly, each client must set theAtmosphereHandler,WebSocketHandler, orMeteorinstances) or extensions (GWT, Jersey, Wicket, etc...)HeaderConfig.X_ATMOSPHERE_TRANSPORTheader. Your AtmosphereHandler must also extends theAbstractReflectorAtmosphereHandleror implements the logic defined insideAbstractReflectorAtmosphereHandler.postStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)- Author:
- Jeanfrancois Arcand
-
-
Constructor Summary
Constructors Constructor Description AtmosphereResourceLifecycleInterceptor()AtmosphereResourceLifecycleInterceptor(boolean force)
-
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)Automatically suspend theAtmosphereResourcebased onAtmosphereResource.TRANSPORTvalue.java.lang.Stringmethod()AtmosphereResourceLifecycleInterceptormethod(java.lang.String method)voidpostInspect(AtmosphereResource r)Invoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.inttimeoutInSeconds()AtmosphereResourceLifecycleInterceptortimeoutInSeconds(int timeoutInSeconds)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
-
method
public java.lang.String method()
-
timeoutInSeconds
public int timeoutInSeconds()
-
method
public AtmosphereResourceLifecycleInterceptor method(java.lang.String method)
-
timeoutInSeconds
public AtmosphereResourceLifecycleInterceptor timeoutInSeconds(int timeoutInSeconds)
-
inspect
public Action inspect(AtmosphereResource r)
Automatically suspend theAtmosphereResourcebased onAtmosphereResource.TRANSPORTvalue.- Specified by:
inspectin interfaceAtmosphereInterceptor- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUE
-
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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-