Package org.atmosphere.cpr
Class AtmosphereFramework
java.lang.Object
org.atmosphere.cpr.AtmosphereFramework
The
AtmosphereFramework is the entry point for the framework. This class can be used to from Servlet/filter
to dispatch AtmosphereRequest and AtmosphereResponse. The framework can also be configured using
the setXXX method. The life cycle of this class is
AtmosphereFramework f = new AtmosphereFramework(); f.init(); f.doCometSupport(AtmosphereRequest, AtmosphereResponse); f.destroy();
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected AsyncSupport<?> protected Stringprotected booleanprotected final BroadcasterSetupprotected final ClasspathScannerprotected final AtmosphereConfigstatic final Stringstatic final List<Class<? extends AtmosphereInterceptor>> static final Stringstatic final Stringprotected final FrameworkEventDispatcherprotected booleanprotected booleanprotected final HandlerRegistryprotected final InterceptorRegistryprotected final AtomicBooleanprotected booleanprotected final AtomicBooleanprotected final booleanprotected booleanprotected booleanprotected booleanprotected static final org.slf4j.Loggerstatic final Stringstatic final Stringprotected Stringprotected AtmosphereObjectFactory<?> protected final ConcurrentLinkedQueue<String> static final AtmosphereHandlerAn implementation ofAbstractReflectorAtmosphereHandler.protected ServletConfigprotected booleanprotected Threadprotected booleanprotected booleanprotected booleanprotected final WebSocketConfig -
Constructor Summary
ConstructorsConstructorDescriptionCreate an AtmosphereFramework.AtmosphereFramework(boolean isFilter, boolean autoDetectHandlers) Create an AtmosphereFramework.Create an AtmosphereFramework and initialize it viainit(jakarta.servlet.ServletConfig). -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotationPackage(Class<?> clazz) Add support for package detection of Atmosphere's Component.addAtmosphereHandler(String mapping, AtmosphereHandler h) Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.addAtmosphereHandler(String mapping, AtmosphereHandler h, String broadcasterId) Add anAtmosphereHandlerserviced by theServlet.addAtmosphereHandler(String mapping, AtmosphereHandler h, String broadcasterId, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServlet.addAtmosphereHandler(String mapping, AtmosphereHandler h, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.addAtmosphereHandler(String mapping, AtmosphereHandler h, Broadcaster broadcaster) Add anAtmosphereHandlerserviced by theServlet.addAtmosphereHandler(String mapping, AtmosphereHandler h, Broadcaster broadcaster, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServlet.Add aBroadcasterCacheInspectorwhich will be associated with the definedBroadcasterCache.AddBroadcasterCacheListenerto theBroadcasterCache.AddBroadcasterListenerto all createdBroadcasters.addBroadcasterType(String broadcasterTypeString) Add a new Broadcaster class name that AtmosphereServlet can use when initializing requests, and when the atmosphere.xml broadcaster element is unspecified.Add a package containing classes annotated withAtmosphereAnnotation.protected voidaddInitParameter(String name, String value) Add init-param like if they were defined in web.xmlprotected voidprotected voidaddInterceptorToWrapper(AtmosphereHandlerWrapper wrapper, List<AtmosphereInterceptor> interceptors) protected voidaddWebSocketHandler(String path, WebSocketHandler handler) Add anWebSocketHandlermapped to the path.addWebSocketHandler(String path, WebSocketHandler handler, AtmosphereHandler h) addWebSocketHandler(String path, WebSocketHandler handler, AtmosphereHandler h, List<AtmosphereInterceptor> l) addWebSocketHandler(WebSocketHandler handler) Add anWebSocketHandlermapped to "/*".booleanallowAllClassesScan(boolean allowAllClassesScan) protected voidReturn theAnnotationProcessorannotationProcessorClassName(String annotationProcessorClassName) annotationScanned(boolean b) Invoked when aAnnotationProcessorfound an annotation.asyncSupportListener(AsyncSupportListener asyncSupportListener) Add anAsyncSupportListener.Return the list ofAsyncSupportListeners.atmosphereResourceListener(AtmosphereResourceListener atmosphereResourceListener) Return the list ofAtmosphereResourceListenerprotected voidvoidautoDetectAtmosphereHandlers(ServletContext servletContext, ClassLoader classloader) Auto detect instance ofAtmosphereHandlerin case META-INF/atmosphere.xml is missing.protected voidAuto detect the underlying Servlet Container we are running on.protected voidautoDetectWebSocketHandler(ServletContext servletContext, ClassLoader classloader) Auto detect instance ofWebSocketHandlerin case META-INF/atmosphere.xml is missing.Return the list ofBroadcastFilters.Add aBroadcastFilter.broadcasterLifeCyclePolicy(String broadcasterLifeCyclePolicy) voidprotected voidprotected voidConfigure the list ofAtmosphereInterceptor.protected voidvoidprotected voidconfigureDetectedFramework(ReflectorServletProcessor rsp, boolean isJersey) protected voidGet a list of possible candidates to load asAtmosphereHandler.protected voidconfigureScanningPackage(ServletConfig sc, String value) protected voidprotected AsyncSupportResolverReturns an instance of AsyncSupportResolverAsyncSupportResolver.protected AtmosphereHandlerWrappercreateWrapperAndConfigureHandler(AtmosphereHandler h, String mapping, List<AtmosphereInterceptor> l) Return the list of packages the framework should look forAtmosphereAnnotation.Class<? extends AtmosphereInterceptor>[]protected voiddestroy()protected voidprotected booleanAuto-detect Jersey when no atmosphere.xml file is specified.Invoke the proprietaryAsyncSupport.protected voidRead init params from web.xml and apply them.protected voiddoInitParams(ServletConfig sc, boolean reconfigure) Read init params from web.xml and apply them.protected voidThe currentEndpointMapperused to map requests toAtmosphereHandler.endPointMapper(EndpointMapper<?> endpointMapper) Set theEndpointMapper.events()Return theFrameworkEventDispatcherfor managing listeners and events.excludeInterceptor(String interceptor) Exclude anAtmosphereInterceptorfrom being added, at startup, by Atmosphere.booleanexternalizeDestroy(boolean externalizeDestroy) If set to true, the task of finishing the request/response lifecycle will not be handled by this class.<T extends AtmosphereInterceptor>
Optional<T> findInterceptor(Class<T> c) Find anAtmosphereInterceptorof the given type.Return the list ofAtmosphereFrameworkListenerAsyncSupport<?> Return the currentAsyncSupport.Return a configured instance ofAtmosphereConfig.Return theBroadcasterCacheclass name.Get theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.Return the defaultBroadcasterclass name.Get the defaultSerializerclass to use forAtmosphereResources.Get the defaultSerializerclass name to use forAtmosphereResources.Return the location of the JARs containing the application classes.Return theServletContextThe currentWebSocketProcessorused to handle websocket requests.Return theHandlerRegistryfor managing handler registration.init()Initialize the AtmosphereFramework.init(ServletConfig sc) Initialize the AtmosphereFramework using theServletContext.init(ServletConfig sc, boolean wrap) Initialize the AtmosphereFramework using theServletContext.voidvoidInitializeAtmosphereServletProcessor.voidvoidinitializationError(IllegalStateException initializationError) If aContainerInitializerfails, set the field initializationError for later logging purposes.booleanReturn true if theinit()has been sucessfully executed.voidReturn the list ofBroadcasterCacheInspectors.protected void<T extends AtmosphereInterceptor>
Tinterceptor(Class<T> c) Deprecated.Add anAtmosphereInterceptorimplementation.Return theInterceptorRegistryfor managing interceptor lifecycle.booleanbooleanWas aBroadcasterdefined in web.xml or programmatically added.booleanReturn true is thedestroy()method has been invoked.booleanReturns true ifExecutorServiceis shared among all components.booleanbooleanbooleanbooleantrue if Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation.protected voidloadAtmosphereDotXml(InputStream stream, ClassLoader c) Load AtmosphereHandler defined under META-INF/atmosphere.xml.voidloadAtmosphereHandlersFromPath(ClassLoader classloader, String realPath) voidprotected voidprotected voidloadWebSocketFromPath(ClassLoader classloader, String realPath) protected StringlookupDefaultBroadcasterType(String defaultB) protected AtmosphereObjectFactory<?> mappingRegex(String mappingRegex) protected AtmosphereInterceptornewAInterceptor(Class<? extends AtmosphereInterceptor> a) protected AtmosphereConfigCreate an instance ofAtmosphereConfig<T,U extends T>
TnewClassInstance(Class<T> classType, Class<U> defaultType) Instantiate a classnormalizePath(String path) notify(Action.TYPE type, AtmosphereRequest request, AtmosphereResponse response) notifyDestroyed(String uuid) notifySuspended(String uuid) voidobjectFactory(AtmosphereObjectFactory<?> objectFactory) Set an object used for class instantiation.protected voidprotected voidprotected voidprotected voidpackages()voidPatch container-specific system properties to work around strict compliance modes.protected voidPrevent Atmosphere from scanning the entire class path.protected voidvoidreconfigureInitParams(boolean reconfigureInitParams) Remove allAtmosphereHandlers.Remove all init parameters.removeAtmosphereHandler(String mapping) Remove anAtmosphereHandler.protected voidservletConfig(ServletConfig sc, boolean wrap) Return theAtmosphereResourceSessionFactoryvoidsessionSupport(boolean sessionSupport) voidsetAsyncSupport(AsyncSupport<?> asyncSupport) Set theAsyncSupportimplementation.setAtmosphereDotXmlPath(String atmosphereDotXmlPath) setBroadcasterCacheClassName(String broadcasterCacheClassName) Set theBroadcasterCacheclass name.setBroadcasterFactory(BroadcasterFactory broadcasterFactory) Set theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.Set the defaultBroadcasterclass name.setDefaultSerializerClassName(String defaultSerializerClassName) Set the defaultSerializerclass name to use forAtmosphereResources.setHandlersPath(String handlersPath) setLibPath(String libPath) Set the location of the JARs containing the application.setUseBlockingImplementation(boolean useBlockingImplementation) setUseNativeImplementation(boolean useNativeImplementation) voidsetUseServlet30(boolean useServlet30) setUseStreamForFlushingComments(boolean useStreamForFlushingComments) Set to true so Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation.setWebsocketProcessorClassName(String webSocketProcessorClassName) Set theWebSocketProcessorclass name used to process WebSocket requests.setWebSocketProtocolClassName(String webSocketProtocolClassName) booleansharedThreadPools(boolean sharedThreadPools) shareExecutorServices(boolean sharedThreadPools) Set to true to have aExecutorServiceshared among all components.protected voiduniverse()Return theUUIDProvideruuidProvider(UUIDProvider uuidProvider) Set aUUIDlike implementation for generating random UUID StringReturn theWebSocketConfigfor managing WebSocket settings.booleanwebSocketEnabled(boolean webSocketEnabled) Return theWebSocketFactorywebSocketFactory(WebSocketFactory webSocketFactory) Configure theWebSocketFactory
-
Field Details
-
DEFAULT_ATMOSPHERE_CONFIG_PATH
- See Also:
-
DEFAULT_LIB_PATH
- See Also:
-
DEFAULT_HANDLER_PATH
- See Also:
-
META_SERVICE
- See Also:
-
MAPPING_REGEX
- See Also:
-
ASYNC_IO
- See Also:
-
logger
protected static final org.slf4j.Logger logger -
eventDispatcher
-
initParams
-
config
-
isCometSupportConfigured
-
isFilter
protected final boolean isFilter -
objectFactoryType
-
useNativeImplementation
protected boolean useNativeImplementation -
useBlockingImplementation
protected boolean useBlockingImplementation -
useStreamForFlushingComments
protected boolean useStreamForFlushingComments -
asyncSupport
-
isCometSupportSpecified
protected boolean isCometSupportSpecified -
isSessionSupportSpecified
protected boolean isSessionSupportSpecified -
isThrowExceptionOnClonedRequestSpecified
protected boolean isThrowExceptionOnClonedRequestSpecified -
servletConfig
-
autoDetectHandlers
protected boolean autoDetectHandlers -
atmosphereDotXmlPath
-
metaServicePath
-
isInit
protected boolean isInit -
executeFirstSet
protected boolean executeFirstSet -
objectFactory
-
isDestroyed
-
externalizeDestroy
protected boolean externalizeDestroy -
shutdownHook
-
webSocketConfig
-
interceptorRegistry
-
handlerRegistry
-
broadcasterSetup
-
classpathScanner
-
DEFAULT_ATMOSPHERE_INTERCEPTORS
-
REFLECTOR_ATMOSPHEREHANDLER
An implementation ofAbstractReflectorAtmosphereHandler.
-
-
Constructor Details
-
AtmosphereFramework
public AtmosphereFramework()Create an AtmosphereFramework. -
AtmosphereFramework
Create an AtmosphereFramework and initialize it viainit(jakarta.servlet.ServletConfig).- Throws:
ServletException
-
AtmosphereFramework
public AtmosphereFramework(boolean isFilter, boolean autoDetectHandlers) Create an AtmosphereFramework.- Parameters:
isFilter- true if this instance is used as anAtmosphereFilter
-
-
Method Details
-
setAndConfigureAtmosphereResourceFactory
-
newAtmosphereConfig
Create an instance ofAtmosphereConfig -
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandler h, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandlerl- An array ofAtmosphereInterceptor.
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandler h, Broadcaster broadcaster, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServlet. This API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandlerbroadcaster- TheBroadcasterassociated with AtmosphereHandlerl- A list ofAtmosphereInterceptors
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandler h, String broadcasterId, List<AtmosphereInterceptor> l) Add anAtmosphereHandlerserviced by theServlet. This API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandlerbroadcasterId- TheBroadcaster.getID()value.l- A list ofAtmosphereInterceptor
-
createWrapperAndConfigureHandler
protected AtmosphereHandlerWrapper createWrapperAndConfigureHandler(AtmosphereHandler h, String mapping, List<AtmosphereInterceptor> l) -
addAtmosphereHandler
Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandler
-
normalizePath
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandler h, String broadcasterId) Add anAtmosphereHandlerserviced by theServlet. This API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandlerbroadcasterId- TheBroadcaster.getID()value
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandler h, Broadcaster broadcaster) Add anAtmosphereHandlerserviced by theServlet. This API is exposed to allow embedding an Atmosphere application.- Parameters:
mapping- The servlet mapping (servlet path)h- implementation of anAtmosphereHandlerbroadcaster- TheBroadcasterassociated with AtmosphereHandler.
-
removeAtmosphereHandler
Remove anAtmosphereHandler.- Parameters:
mapping- the mapping used when invokingaddAtmosphereHandler(String, AtmosphereHandler);- Returns:
- true if removed
-
removeAllAtmosphereHandler
Remove allAtmosphereHandlers. -
removeAllInitParams
Remove all init parameters. -
addInitParameter
Add init-param like if they were defined in web.xml- Parameters:
name- The namevalue- The value
-
readSystemProperties
protected void readSystemProperties() -
patchContainer
public void patchContainer()Patch container-specific system properties to work around strict compliance modes. Delegates toContainerPatcherwhich logs modifications and respects theApplicationConfig.DISABLE_CONTAINER_PATCHINGopt-out. -
init
Initialize the AtmosphereFramework. Invoke this method after having properly configured this class using the setters. -
init
Initialize the AtmosphereFramework using theServletContext.- Parameters:
sc- theServletContext- Throws:
ServletException
-
preventOOM
protected void preventOOM()Prevent Atmosphere from scanning the entire class path. -
init
Initialize the AtmosphereFramework using theServletContext.- Parameters:
sc- theServletContext- Throws:
ServletException
-
servletConfig
-
reconfigureInitParams
public void reconfigureInitParams(boolean reconfigureInitParams) -
universe
protected void universe() -
analytics
protected void analytics() -
configureAtmosphereInterceptor
Configure the list ofAtmosphereInterceptor.- Parameters:
sc- a ServletConfig
-
newAInterceptor
-
configureWebDotXmlAtmosphereHandler
-
configureScanningPackage
-
defaultPackagesToScan
protected void defaultPackagesToScan() -
configureBroadcasterFactory
public void configureBroadcasterFactory() -
configureBroadcaster
protected void configureBroadcaster() -
installAnnotationProcessor
-
doInitParamsForWebSocket
-
doInitParams
Read init params from web.xml and apply them.- Parameters:
sc-ServletConfig
-
doInitParams
Read init params from web.xml and apply them.- Parameters:
sc-ServletConfig
-
loadConfiguration
- Throws:
ServletException
-
detectSupportedFramework
Auto-detect Jersey when no atmosphere.xml file is specified.- Parameters:
sc-ServletConfig- Returns:
- true if Jersey classes are detected
- Throws:
ClassNotFoundExceptionException
-
configureDetectedFramework
-
lookupDefaultBroadcasterType
-
lookupDefaultObjectFactoryType
-
sessionSupport
public void sessionSupport(boolean sessionSupport) -
initAtmosphereHandler
InitializeAtmosphereServletProcessor.- Parameters:
sc- theServletConfig- Throws:
ServletException
-
initAtmosphereHandler
- Throws:
ServletException
-
checkWebSocketSupportState
public void checkWebSocketSupportState() -
initWebSocket
public void initWebSocket() -
initEndpointMapper
public void initEndpointMapper() -
closeAtmosphereResource
protected void closeAtmosphereResource() -
destroy
-
destroyInterceptors
protected void destroyInterceptors() -
resetStates
-
loadMetaService
protected void loadMetaService() -
loadAtmosphereDotXml
protected void loadAtmosphereDotXml(InputStream stream, ClassLoader c) throws IOException, ServletException Load AtmosphereHandler defined under META-INF/atmosphere.xml.- Parameters:
stream- The input stream we read from.c- The classloader- Throws:
IOExceptionServletException
-
setAsyncSupport
Set theAsyncSupportimplementation. Make sure you don't set an implementation that only works on some container. SeeBlockingIOCometSupportfor an example.- Parameters:
asyncSupport-
-
getAsyncSupport
Return the currentAsyncSupport.- Returns:
- the current
AsyncSupport
-
createAsyncSupportResolver
Returns an instance of AsyncSupportResolverAsyncSupportResolver.- Returns:
- CometSupportResolver
-
autoDetectContainer
protected void autoDetectContainer()Auto detect the underlying Servlet Container we are running on. -
autoDetectAtmosphereHandlers
public void autoDetectAtmosphereHandlers(ServletContext servletContext, ClassLoader classloader) throws MalformedURLException Auto detect instance ofAtmosphereHandlerin case META-INF/atmosphere.xml is missing.- Parameters:
servletContext-ServletContextclassloader-ClassLoaderto load the class.- Throws:
MalformedURLException
-
loadAtmosphereHandlersFromPath
-
autoDetectWebSocketHandler
protected void autoDetectWebSocketHandler(ServletContext servletContext, ClassLoader classloader) throws MalformedURLException Auto detect instance ofWebSocketHandlerin case META-INF/atmosphere.xml is missing.- Parameters:
servletContext-ServletContextclassloader-ClassLoaderto load the class.- Throws:
MalformedURLException
-
loadWebSocketFromPath
-
configureRequestResponse
public AtmosphereFramework configureRequestResponse(AtmosphereRequest req, AtmosphereResponse res) throws UnsupportedEncodingException Get a list of possible candidates to load asAtmosphereHandler.- Parameters:
req-AtmosphereRequest- Throws:
UnsupportedEncodingException
-
doCometSupport
public Action doCometSupport(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException Invoke the proprietaryAsyncSupport.- Parameters:
req-res-- Returns:
- an
Action - Throws:
IOExceptionServletException
-
getDefaultBroadcasterClassName
Return the defaultBroadcasterclass name.- Returns:
- the broadcasterClassName
-
setDefaultBroadcasterClassName
Set the defaultBroadcasterclass name.- Parameters:
bccn- the broadcasterClassName to set
-
isUseStreamForFlushingComments
public boolean isUseStreamForFlushingComments()true if Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation.- Returns:
- the useStreamForFlushingComments
-
isUseServlet30
public boolean isUseServlet30() -
setUseStreamForFlushingComments
Set to true so Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation. Default is false.- Parameters:
useStreamForFlushingComments- the useStreamForFlushingComments to set
-
getBroadcasterFactory
Get theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.- Returns:
BroadcasterFactory
-
setBroadcasterFactory
Set theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.- Returns:
BroadcasterFactory
-
getBroadcasterCacheClassName
Return theBroadcasterCacheclass name.- Returns:
- the
BroadcasterCacheclass name
-
setBroadcasterCacheClassName
Set theBroadcasterCacheclass name.- Parameters:
broadcasterCacheClassName-
-
addBroadcasterType
Add a new Broadcaster class name that AtmosphereServlet can use when initializing requests, and when the atmosphere.xml broadcaster element is unspecified.- Parameters:
broadcasterTypeString-
-
broadcasterTypes
-
getWebSocketProtocolClassName
-
setWebSocketProtocolClassName
-
getAtmosphereHandlers
-
configureQueryStringAsRequest
-
getWebSocketProtocol
-
isUseNativeImplementation
public boolean isUseNativeImplementation() -
setUseNativeImplementation
-
isUseBlockingImplementation
public boolean isUseBlockingImplementation() -
setUseBlockingImplementation
-
getAtmosphereDotXmlPath
-
setAtmosphereDotXmlPath
-
getHandlersPath
-
setHandlersPath
-
getLibPath
Return the location of the JARs containing the application classes. Default is WEB-INF/lib.- Returns:
- the location of the JARs containing the application classes. Default is WEB-INF/lib
-
setLibPath
Set the location of the JARs containing the application.- Parameters:
libPath- the location of the JARs containing the application.- Returns:
- this
-
getWebSocketProcessorClassName
The currentWebSocketProcessorused to handle websocket requests.- Returns:
WebSocketProcessor
-
setWebsocketProcessorClassName
Set theWebSocketProcessorclass name used to process WebSocket requests. Default isDefaultWebSocketProcessor- Parameters:
webSocketProcessorClassName-WebSocketProcessor- Returns:
- this
-
interceptor
Add anAtmosphereInterceptorimplementation. The adding order ofAtmosphereInterceptorwill be used, e.g the first addedAtmosphereInterceptorwill always be called first.- Parameters:
c-AtmosphereInterceptor- Returns:
- this
-
addDefaultOrAppInterceptors
protected void addDefaultOrAppInterceptors() -
addInterceptorToAllWrappers
-
addInterceptorToWrapper
-
addInterceptorToWrapper
protected void addInterceptorToWrapper(AtmosphereHandlerWrapper wrapper, List<AtmosphereInterceptor> interceptors) -
interceptors
-
interceptor
@Deprecated(since="4.0.0", forRemoval=false) public <T extends AtmosphereInterceptor> T interceptor(Class<T> c) Deprecated.UsefindInterceptor(Class)which returnsOptionalinstead of null.Find anAtmosphereInterceptorof the given type.- Parameters:
c- the interceptor class to look for- Returns:
- the interceptor instance, or null if not found.
-
findInterceptor
Find anAtmosphereInterceptorof the given type.This is the preferred alternative to
interceptor(Class)as it returns anOptionalinstead of null, making the absent-interceptor case explicit at the call site.- Parameters:
c- the interceptor class to look for- Returns:
- an
Optionalcontaining the interceptor, or empty if not found.
-
annotationProcessorClassName
-
events
Return theFrameworkEventDispatcherfor managing listeners and events.- Returns:
- the event dispatcher
-
webSocket
Return theWebSocketConfigfor managing WebSocket settings.- Returns:
- the WebSocket configuration
-
interceptorRegistry
Return theInterceptorRegistryfor managing interceptor lifecycle.- Returns:
- the interceptor registry
-
handlerRegistry
Return theHandlerRegistryfor managing handler registration.- Returns:
- the handler registry
-
asyncSupportListener
Add anAsyncSupportListener.- Parameters:
asyncSupportListener- anAsyncSupportListener- Returns:
- this;
-
asyncSupportListeners
Return the list ofAsyncSupportListeners.- Returns:
-
addBroadcasterListener
AddBroadcasterListenerto all createdBroadcasters. -
addBroadcasterCacheListener
AddBroadcasterCacheListenerto theBroadcasterCache. -
broadcasterCacheListeners
-
addBroadcasterCacheInjector
Add aBroadcasterCacheInspectorwhich will be associated with the definedBroadcasterCache.- Parameters:
b-BroadcasterCacheInspector- Returns:
- this;
-
inspectors
Return the list ofBroadcasterCacheInspectors.- Returns:
- the list of
BroadcasterCacheInspectors
-
getAtmosphereConfig
Return a configured instance ofAtmosphereConfig.- Returns:
- a configured instance of
AtmosphereConfig
-
getServletContext
Return theServletContext- Returns:
- the
ServletContext
-
getServletConfig
-
broadcasterFilters
Return the list ofBroadcastFilters.- Returns:
- the list of
BroadcastFilters
-
broadcasterFilters
Add aBroadcastFilter.- Returns:
-
autoConfigureService
- Throws:
IOException
-
endPointMapper
The currentEndpointMapperused to map requests toAtmosphereHandler.- Returns:
EndpointMapper
-
endPointMapper
Set theEndpointMapper.- Parameters:
endpointMapper-EndpointMapper- Returns:
- this
-
addAnnotationPackage
Add support for package detection of Atmosphere's Component.- Parameters:
clazz- a Class- Returns:
- this.
-
notify
public AtmosphereFramework notify(Action.TYPE type, AtmosphereRequest request, AtmosphereResponse response) -
notifyDestroyed
-
notifySuspended
-
addWebSocketHandler
Add anWebSocketHandlermapped to "/*". return this -
addWebSocketHandler
Add anWebSocketHandlermapped to the path. return this -
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(String path, WebSocketHandler handler, AtmosphereHandler h) - Parameters:
path- a pathhandler- aWebSocketHandlerh- anAtmosphereHandler- Returns:
- this
-
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(String path, WebSocketHandler handler, AtmosphereHandler h, List<AtmosphereInterceptor> l) - Parameters:
path- a pathhandler- aWebSocketHandlerh- anAtmosphereHandlerl-AtmosphereInterceptor- Returns:
- this
-
annotationScanned
Invoked when aAnnotationProcessorfound an annotation.- Parameters:
b- true when found- Returns:
- this
-
initialized
public boolean initialized()Return true if theinit()has been sucessfully executed.- Returns:
- true if the
init()has been sucessfully executed.
-
packages
-
customAnnotationPackages
Return the list of packages the framework should look forAtmosphereAnnotation.- Returns:
- the list of packages the framework should look for
AtmosphereAnnotation
-
addCustomAnnotationPackage
Add a package containing classes annotated withAtmosphereAnnotation.- Parameters:
p- a package- Returns:
- this;
-
newClassInstance
public <T,U extends T> T newClassInstance(Class<T> classType, Class<U> defaultType) throws InstantiationException, IllegalAccessException Instantiate a class- Parameters:
classType- The Required Class's TypedefaultType- The default implementation of the Class's Type.- Returns:
- the an instance of defaultType
- Throws:
InstantiationExceptionIllegalAccessException
-
objectFactory
Set an object used for class instantiation. Allows for integration with dependency injection frameworks.- Parameters:
objectFactory-
-
externalizeDestroy
If set to true, the task of finishing the request/response lifecycle will not be handled by this class.- Parameters:
externalizeDestroy-- Returns:
- this
-
annotationProcessor
Return theAnnotationProcessor- Returns:
- the
AnnotationProcessor
-
isBroadcasterSpecified
public boolean isBroadcasterSpecified()Was aBroadcasterdefined in web.xml or programmatically added.- Returns:
- true is defined.
-
configureObjectFactory
protected void configureObjectFactory() -
excludeInterceptor
Exclude anAtmosphereInterceptorfrom being added, at startup, by Atmosphere. The default'sDEFAULT_ATMOSPHERE_INTERCEPTORSare candidates for being excluded.- Parameters:
interceptor- anAtmosphereInterceptorclass name- Returns:
- this
-
filterManipulator
-
filterManipulators
-
isAServletFilter
public boolean isAServletFilter() -
objectFactoryType
-
mappingRegex
-
mappingRegex
-
setUseServlet30
public void setUseServlet30(boolean useServlet30) -
webSocketEnabled
public boolean webSocketEnabled() -
webSocketEnabled
-
broadcasterLifeCyclePolicy
-
broadcasterLifeCyclePolicy
-
broadcasterListeners
-
allowAllClassesScan
public boolean allowAllClassesScan() -
allowAllClassesScan
-
objectFactory
-
externalizeDestroy
public boolean externalizeDestroy() -
excludedInterceptors
-
defaultInterceptors
-
atmosphereFactory
-
metaBroadcaster
-
getDefaultSerializerClassName
Get the defaultSerializerclass name to use forAtmosphereResources.- Returns:
- the class name as a string, might be null if not configured
-
getDefaultSerializerClass
Get the defaultSerializerclass to use forAtmosphereResources.- Returns:
- the class, might be null if not configured
-
setDefaultSerializerClassName
Set the defaultSerializerclass name to use forAtmosphereResources.- Parameters:
defaultSerializerClassName- the class name to use- Returns:
- this
-
sessionFactory
Return theAtmosphereResourceSessionFactory- Returns:
- the AtmosphereResourceSessionFactory
-
isDestroyed
public boolean isDestroyed()Return true is thedestroy()method has been invoked.- Returns:
- true is the
destroy()method has been invoked.
-
frameworkListener
- Parameters:
l-AtmosphereFrameworkListener- Returns:
- this;
-
frameworkListeners
Return the list ofAtmosphereFrameworkListener- Returns:
AtmosphereFrameworkListener
-
onPreInit
protected void onPreInit() -
onPostInit
protected void onPostInit() -
onPreDestroy
protected void onPreDestroy() -
onPostDestroy
protected void onPostDestroy() -
atmosphereResourceListeners
Return the list ofAtmosphereResourceListener- Returns:
- the list of
AtmosphereResourceListener
-
atmosphereResourceListener
public AtmosphereFramework atmosphereResourceListener(AtmosphereResourceListener atmosphereResourceListener) - Parameters:
atmosphereResourceListener- aAtmosphereResourceListener- Returns:
- this
-
uuidProvider
Set aUUIDlike implementation for generating random UUID String- Parameters:
uuidProvider-- Returns:
- this
-
uuidProvider
Return theUUIDProvider- Returns:
UUIDProvider
-
webSocketFactory
Return theWebSocketFactory- Returns:
- the
WebSocketFactory
-
webSocketFactory
Configure theWebSocketFactory- Parameters:
webSocketFactory- theWebSocketFactory- Returns:
- this
-
initializationError
If aContainerInitializerfails, set the field initializationError for later logging purposes.- Parameters:
initializationError-
-
findInterceptor(Class)which returnsOptionalinstead of null.