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, AtmosphereResource); f.destroy();
- Author:
- Jeanfrancois Arcand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classstatic enumThis enumeration represents all possible actions to specify in a meta service file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected final LinkedList<String> protected AnnotationProcessorprotected Stringprotected AtmosphereResourceFactorystatic final Stringprotected AsyncSupportprotected final List<AsyncSupportListener> protected Stringprotected final Map<String, AtmosphereFramework.AtmosphereHandlerWrapper> protected final List<AtmosphereResourceListener> protected booleanprotected Stringprotected final LinkedList<BroadcasterCacheListener> protected Stringprotected BroadcasterFactoryprotected Stringprotected Stringprotected final List<BroadcasterListener> protected final ConcurrentLinkedQueue<String> protected final AtmosphereConfigstatic final Stringstatic final List<Class<? extends AtmosphereInterceptor>> static final Stringstatic final Stringprotected Class<Serializer> protected Stringprotected booleanprotected booleanprotected final List<BroadcasterConfig.FilterManipulator> protected final List<AtmosphereFrameworkListener> protected Stringprotected final ConcurrentLinkedQueue<BroadcasterCacheInspector> protected final LinkedList<AtmosphereInterceptor> protected booleanprotected final AtomicBooleanprotected booleanprotected final AtomicBooleanprotected final booleanprotected booleanprotected booleanprotected booleanprotected Stringprotected static final org.slf4j.Loggerstatic final Stringprotected Stringstatic final Stringprotected MetaBroadcasterprotected Stringprotected AtmosphereObjectFactory<?> protected final ConcurrentLinkedQueue<String> static final AtmosphereHandlerAn implementation ofAbstractReflectorAtmosphereHandler.protected booleanprotected javax.servlet.ServletConfigprotected AtmosphereResourceSessionFactoryprotected booleanprotected Threadprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected Stringprotected WebSocketProtocolprotected Stringprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionCreate an AtmosphereFramework.AtmosphereFramework(boolean isFilter, boolean autoDetectHandlers) Create an AtmosphereFramework.AtmosphereFramework(javax.servlet.ServletConfig sc) Create an AtmosphereFramework and initialize it viainit(javax.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(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, List<AtmosphereInterceptor> interceptors) protected voidaddInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, AtmosphereInterceptor c) addWebSocketHandler(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 voidautoConfigureService(javax.servlet.ServletContext sc) voidautoDetectAtmosphereHandlers(javax.servlet.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(javax.servlet.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 voidconfigureAtmosphereInterceptor(javax.servlet.ServletConfig sc) Configure the list ofAtmosphereInterceptor.protected voidvoidprotected voidconfigureDetectedFramework(ReflectorServletProcessor rsp, boolean isJersey) protected voidConfigure some attributes on theAtmosphereRequest.protected voidconfigureScanningPackage(javax.servlet.ServletConfig sc, String value) protected voidconfigureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc) protected AsyncSupportResolverReturns an instance of AsyncSupportResolverAsyncSupportResolver.createWrapperAndConfigureHandler(AtmosphereHandler h, String mapping, List<AtmosphereInterceptor> l) Return the list of packages the framework should look forAtmosphereAnnotation.Class<? extends AtmosphereInterceptor>[]protected voiddestroy()protected voidprotected booleandetectSupportedFramework(javax.servlet.ServletConfig sc) Auto-detect Jersey when no atmosphere.xml file is specified.Invoke the proprietaryAsyncSupport.protected voiddoInitParams(javax.servlet.ServletConfig sc) Read init params from web.xml and apply them.protected voiddoInitParams(javax.servlet.ServletConfig sc, boolean reconfigure) Read init params from web.xml and apply them.protected voiddoInitParamsForWebSocket(javax.servlet.ServletConfig sc) The currentEndpointMapperused to map requests toAtmosphereHandler.endPointMapper(EndpointMapper endpointMapper) Set theEndpointMapper.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.Return the list ofAtmosphereFrameworkListenerReturn the currentAsyncSupport.Return a configured instance ofAtmosphereConfig.Return theBroadcasterCacheclass name.Get theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.Deprecated.Use getAsyncSupportReturn 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.javax.servlet.ServletConfigjavax.servlet.ServletContextReturn theServletContextThe currentWebSocketProcessorused to handle websocket requests.init()Initialize the AtmosphereFramework.init(javax.servlet.ServletConfig sc) Initialize the AtmosphereFramework using theServletContext.init(javax.servlet.ServletConfig sc, boolean wrap) Initialize the AtmosphereFramework using theServletContext.voidvoidinitAtmosphereHandler(javax.servlet.ServletConfig sc) InitializeAtmosphereServletProcessor.voidvoidinitializationError(IllegalStateException initializationError) If aContainerInitializerfail, log the excetion here.booleanReturn true if theinit()has been sucessfully executed.voidReturn the list ofBroadcasterCacheInspectors.protected voidinstallAnnotationProcessor(javax.servlet.ServletConfig sc) <T extends AtmosphereInterceptor>
Tinterceptor(Class<T> c) Add anAtmosphereInterceptorimplementation.Return the list ofAtmosphereInterceptor.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) voidloadConfiguration(javax.servlet.ServletConfig sc) protected 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()voidPath specific container using their own property.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(javax.servlet.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.setCometSupport(AsyncSupport asyncSupport) 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 StringbooleanwebSocketEnabled(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 -
broadcasterFilters
-
asyncSupportListeners
-
atmosphereResourceListeners
-
possibleComponentsCandidate
-
initParams
-
config
-
isCometSupportConfigured
-
isFilter
protected final boolean isFilter -
atmosphereHandlers
-
broadcasterTypes
-
objectFactoryType
-
inspectors
-
mappingRegex
-
useNativeImplementation
protected boolean useNativeImplementation -
useBlockingImplementation
protected boolean useBlockingImplementation -
useStreamForFlushingComments
protected boolean useStreamForFlushingComments -
useServlet30
protected boolean useServlet30 -
asyncSupport
-
broadcasterClassName
-
isCometSupportSpecified
protected boolean isCometSupportSpecified -
isBroadcasterSpecified
protected boolean isBroadcasterSpecified -
isSessionSupportSpecified
protected boolean isSessionSupportSpecified -
isThrowExceptionOnClonedRequestSpecified
protected boolean isThrowExceptionOnClonedRequestSpecified -
broadcasterFactory
-
broadcasterFactoryClassName
-
broadcasterCacheClassName
-
webSocketEnabled
protected boolean webSocketEnabled -
broadcasterLifeCyclePolicy
-
webSocketProtocolClassName
-
webSocketProtocol
-
handlersPath
-
servletConfig
protected javax.servlet.ServletConfig servletConfig -
autoDetectHandlers
protected boolean autoDetectHandlers -
atmosphereDotXmlPath
-
metaServicePath
-
interceptors
-
scanDone
protected boolean scanDone -
annotationProcessorClassName
-
broadcasterListeners
-
webSocketProcessorClassName
-
webSocketProtocolInitialized
protected boolean webSocketProtocolInitialized -
endpointMapper
-
libPath
-
isInit
protected boolean isInit -
packages
-
annotationPackages
-
allowAllClassesScan
protected boolean allowAllClassesScan -
annotationFound
protected boolean annotationFound -
executeFirstSet
protected boolean executeFirstSet -
objectFactory
-
isDestroyed
-
externalizeDestroy
protected boolean externalizeDestroy -
annotationProcessor
-
excludedInterceptors
-
broadcasterCacheListeners
-
filterManipulators
-
arFactory
-
metaBroadcaster
-
sessionFactory
-
defaultSerializerClassName
-
defaultSerializerClass
-
frameworkListeners
-
shutdownHook
-
DEFAULT_ATMOSPHERE_INTERCEPTORS
-
REFLECTOR_ATMOSPHEREHANDLER
An implementation ofAbstractReflectorAtmosphereHandler.
-
-
Constructor Details
-
AtmosphereFramework
public AtmosphereFramework()Create an AtmosphereFramework. -
AtmosphereFramework
public AtmosphereFramework(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException Create an AtmosphereFramework and initialize it viainit(javax.servlet.ServletConfig).- Throws:
javax.servlet.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 AtmosphereFramework.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()Path specific container using their own property. -
init
Initialize the AtmosphereFramework. Invoke this method after having properly configured this class using the setters. -
init
public AtmosphereFramework init(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException Initialize the AtmosphereFramework using theServletContext.- Parameters:
sc- theServletContext- Throws:
javax.servlet.ServletException
-
preventOOM
protected void preventOOM()Prevent Atmosphere from scanning the entire class path. -
init
public AtmosphereFramework init(javax.servlet.ServletConfig sc, boolean wrap) throws javax.servlet.ServletException Initialize the AtmosphereFramework using theServletContext.- Parameters:
sc- theServletContext- Throws:
javax.servlet.ServletException
-
servletConfig
protected void servletConfig(javax.servlet.ServletConfig sc, boolean wrap) -
reconfigureInitParams
public void reconfigureInitParams(boolean reconfigureInitParams) -
universe
protected void universe() -
analytics
protected void analytics() -
configureAtmosphereInterceptor
protected void configureAtmosphereInterceptor(javax.servlet.ServletConfig sc) Configure the list ofAtmosphereInterceptor.- Parameters:
sc- a ServletConfig
-
newAInterceptor
-
configureWebDotXmlAtmosphereHandler
protected void configureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc) -
configureScanningPackage
-
defaultPackagesToScan
protected void defaultPackagesToScan() -
configureBroadcasterFactory
public void configureBroadcasterFactory() -
configureBroadcaster
protected void configureBroadcaster() -
installAnnotationProcessor
protected void installAnnotationProcessor(javax.servlet.ServletConfig sc) -
doInitParamsForWebSocket
protected void doInitParamsForWebSocket(javax.servlet.ServletConfig sc) -
doInitParams
protected void doInitParams(javax.servlet.ServletConfig sc) Read init params from web.xml and apply them.- Parameters:
sc-ServletConfig
-
doInitParams
protected void doInitParams(javax.servlet.ServletConfig sc, boolean reconfigure) Read init params from web.xml and apply them.- Parameters:
sc-ServletConfig
-
loadConfiguration
public void loadConfiguration(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException - Throws:
javax.servlet.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
public void initAtmosphereHandler(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException InitializeAtmosphereServletProcessor.- Parameters:
sc- theServletConfig- Throws:
javax.servlet.ServletException
-
initAtmosphereHandler
public void initAtmosphereHandler() throws javax.servlet.ServletException- Throws:
javax.servlet.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, javax.servlet.ServletException Load AtmosphereHandler defined under META-INF/atmosphere.xml.- Parameters:
stream- The input stream we read from.c- The classloader- Throws:
IOExceptionjavax.servlet.ServletException
-
setAsyncSupport
Set theAsyncSupportimplementation. Make sure you don't set an implementation that only works on some container. SeeBlockingIOCometSupportfor an example.- Parameters:
asyncSupport-
-
setCometSupport
- Parameters:
asyncSupport-- Returns:
-
getAsyncSupport
Return the currentAsyncSupport.- Returns:
- the current
AsyncSupport
-
getCometSupport
Deprecated.Use getAsyncSupportReturn 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(javax.servlet.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(javax.servlet.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 Configure some attributes on theAtmosphereRequest.- Parameters:
req-AtmosphereRequest- Throws:
UnsupportedEncodingException
-
doCometSupport
public Action doCometSupport(AtmosphereRequest req, AtmosphereResponse res) throws IOException, javax.servlet.ServletException Invoke the proprietaryAsyncSupport.- Parameters:
req-res-- Returns:
- an
Action - Throws:
IOExceptionjavax.servlet.ServletException
-
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
protected void addInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, AtmosphereInterceptor c) -
addInterceptorToWrapper
protected void addInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, List<AtmosphereInterceptor> interceptors) -
interceptors
Return the list ofAtmosphereInterceptor.- Returns:
- the list of
AtmosphereInterceptor
-
interceptor
-
annotationProcessorClassName
-
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
public javax.servlet.ServletContext getServletContext()Return theServletContext- Returns:
- the
ServletContext
-
getServletConfig
public javax.servlet.ServletConfig 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 aContainerInitializerfail, log the excetion here.- Parameters:
initializationError-
-