Package org.atmosphere.cpr
Class AtmosphereFramework
- java.lang.Object
-
- org.atmosphere.cpr.AtmosphereFramework
-
public class AtmosphereFramework extends java.lang.ObjectTheAtmosphereFrameworkis the entry point for the framework. This class can be used to from Servlet/filter to dispatchAtmosphereRequestandAtmosphereResponse. The framework can also be configured using the setXXX method. The life cycle of this class isAtmosphereFramework f = new AtmosphereFramework(); f.init(); f.doCometSupport(AtmosphereRequest, AtmosphereResource); f.destroy();
- Author:
- Jeanfrancois Arcand
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAtmosphereFramework.AtmosphereHandlerWrapperstatic classAtmosphereFramework.DefaultAtmosphereObjectFactorystatic classAtmosphereFramework.MetaServiceActionThis enumeration represents all possible actions to specify in a meta service file.
-
Field Summary
Fields Modifier and Type Field Description protected booleanallowAllClassesScanprotected booleanannotationFoundprotected java.util.LinkedList<java.lang.String>annotationPackagesprotected AnnotationProcessorannotationProcessorprotected java.lang.StringannotationProcessorClassNameprotected AtmosphereResourceFactoryarFactorystatic java.lang.StringASYNC_IOprotected AsyncSupportasyncSupportprotected java.util.List<AsyncSupportListener>asyncSupportListenersprotected java.lang.StringatmosphereDotXmlPathprotected java.util.Map<java.lang.String,AtmosphereFramework.AtmosphereHandlerWrapper>atmosphereHandlersprotected java.util.List<AtmosphereResourceListener>atmosphereResourceListenersprotected booleanautoDetectHandlersprotected java.lang.StringbroadcasterCacheClassNameprotected java.util.LinkedList<BroadcasterCacheListener>broadcasterCacheListenersprotected java.lang.StringbroadcasterClassNameprotected BroadcasterFactorybroadcasterFactoryprotected java.lang.StringbroadcasterFactoryClassNameprotected java.util.List<java.lang.String>broadcasterFiltersprotected java.lang.StringbroadcasterLifeCyclePolicyprotected java.util.List<BroadcasterListener>broadcasterListenersprotected java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>broadcasterTypesprotected AtmosphereConfigconfigstatic java.lang.StringDEFAULT_ATMOSPHERE_CONFIG_PATHstatic java.util.List<java.lang.Class<? extends AtmosphereInterceptor>>DEFAULT_ATMOSPHERE_INTERCEPTORSstatic java.lang.StringDEFAULT_HANDLER_PATHstatic java.lang.StringDEFAULT_LIB_PATHprotected java.lang.Class<Serializer>defaultSerializerClassprotected java.lang.StringdefaultSerializerClassNameprotected EndpointMapper<AtmosphereFramework.AtmosphereHandlerWrapper>endpointMapperprotected java.util.List<java.lang.String>excludedInterceptorsprotected booleanexecuteFirstSetprotected booleanexternalizeDestroyprotected java.util.List<BroadcasterConfig.FilterManipulator>filterManipulatorsprotected java.util.List<AtmosphereFrameworkListener>frameworkListenersprotected java.lang.StringhandlersPathprotected java.util.HashMap<java.lang.String,java.lang.String>initParamsprotected java.util.concurrent.ConcurrentLinkedQueue<BroadcasterCacheInspector>inspectorsprotected java.util.LinkedList<AtmosphereInterceptor>interceptorsprotected booleanisBroadcasterSpecifiedprotected java.util.concurrent.atomic.AtomicBooleanisCometSupportConfiguredprotected booleanisCometSupportSpecifiedprotected java.util.concurrent.atomic.AtomicBooleanisDestroyedprotected booleanisFilterprotected booleanisInitprotected booleanisSessionSupportSpecifiedprotected booleanisThrowExceptionOnClonedRequestSpecifiedprotected java.lang.StringlibPathprotected static org.slf4j.Loggerloggerstatic java.lang.StringMAPPING_REGEXprotected java.lang.StringmappingRegexstatic java.lang.StringMETA_SERVICEprotected MetaBroadcastermetaBroadcasterprotected java.lang.StringmetaServicePathprotected AtmosphereObjectFactory<?>objectFactoryprotected java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>objectFactoryTypeprotected java.util.List<java.lang.String>packagesprotected java.util.ArrayList<java.lang.String>possibleComponentsCandidatestatic AtmosphereHandlerREFLECTOR_ATMOSPHEREHANDLERAn implementation ofAbstractReflectorAtmosphereHandler.protected booleanscanDoneprotected javax.servlet.ServletConfigservletConfigprotected AtmosphereResourceSessionFactorysessionFactoryprotected booleansharedThreadPoolsprotected java.lang.ThreadshutdownHookprotected booleanuseBlockingImplementationprotected booleanuseNativeImplementationprotected booleanuseServlet30protected booleanuseStreamForFlushingCommentsprotected booleanwebSocketEnabledprotected java.lang.StringwebSocketProcessorClassNameprotected WebSocketProtocolwebSocketProtocolprotected java.lang.StringwebSocketProtocolClassNameprotected booleanwebSocketProtocolInitialized
-
Constructor Summary
Constructors Constructor Description AtmosphereFramework()Create 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AtmosphereFrameworkaddAnnotationPackage(java.lang.Class<?> clazz)Add support for package detection of Atmosphere's Component.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h)Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, java.lang.String broadcasterId)Add anAtmosphereHandlerserviced by theServlet.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, java.lang.String broadcasterId, java.util.List<AtmosphereInterceptor> l)Add anAtmosphereHandlerserviced by theServlet.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, java.util.List<AtmosphereInterceptor> l)Add anAtmosphereHandlerserviced by theServletThis API is exposed to allow embedding an Atmosphere application.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, Broadcaster broadcaster)Add anAtmosphereHandlerserviced by theServlet.AtmosphereFrameworkaddAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, Broadcaster broadcaster, java.util.List<AtmosphereInterceptor> l)Add anAtmosphereHandlerserviced by theServlet.AtmosphereFrameworkaddBroadcasterCacheInjector(BroadcasterCacheInspector b)Add aBroadcasterCacheInspectorwhich will be associated with the definedBroadcasterCache.AtmosphereFrameworkaddBroadcasterCacheListener(BroadcasterCacheListener b)AddBroadcasterCacheListenerto theBroadcasterCache.AtmosphereFrameworkaddBroadcasterListener(BroadcasterListener b)AddBroadcasterListenerto all createdBroadcasters.AtmosphereFrameworkaddBroadcasterType(java.lang.String broadcasterTypeString)Add a new Broadcaster class name that AtmosphereServlet can use when initializing requests, and when the atmosphere.xml broadcaster element is unspecified.AtmosphereFrameworkaddCustomAnnotationPackage(java.lang.Class p)Add a package containing classes annotated withAtmosphereAnnotation.protected voidaddDefaultOrAppInterceptors()AtmosphereFrameworkaddInitParameter(java.lang.String name, java.lang.String value)Add init-param like if they were defined in web.xmlprotected voidaddInterceptorToAllWrappers(AtmosphereInterceptor c)protected voidaddInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, java.util.List<AtmosphereInterceptor> interceptors)protected voidaddInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, AtmosphereInterceptor c)AtmosphereFrameworkaddWebSocketHandler(java.lang.String path, WebSocketHandler handler)Add anWebSocketHandlermapped to the path.AtmosphereFrameworkaddWebSocketHandler(java.lang.String path, WebSocketHandler handler, AtmosphereHandler h)AtmosphereFrameworkaddWebSocketHandler(java.lang.String path, WebSocketHandler handler, AtmosphereHandler h, java.util.List<AtmosphereInterceptor> l)AtmosphereFrameworkaddWebSocketHandler(WebSocketHandler handler)Add anWebSocketHandlermapped to "/*".booleanallowAllClassesScan()AtmosphereFrameworkallowAllClassesScan(boolean allowAllClassesScan)protected voidanalytics()AnnotationProcessorannotationProcessor()Return theAnnotationProcessorAtmosphereFrameworkannotationProcessorClassName(java.lang.String annotationProcessorClassName)Set theAnnotationProcessorclass name.AtmosphereFrameworkannotationScanned(boolean b)Invoked when aAnnotationProcessorfound an annotation.AtmosphereFrameworkasyncSupportListener(AsyncSupportListener asyncSupportListener)Add anAsyncSupportListener.java.util.List<AsyncSupportListener>asyncSupportListeners()Return the list ofAsyncSupportListeners.AtmosphereResourceFactoryatmosphereFactory()AtmosphereFrameworkatmosphereResourceListener(AtmosphereResourceListener atmosphereResourceListener)java.util.List<AtmosphereResourceListener>atmosphereResourceListeners()Return the list ofAtmosphereResourceListenerprotected voidautoConfigureService(javax.servlet.ServletContext sc)voidautoDetectAtmosphereHandlers(javax.servlet.ServletContext servletContext, java.lang.ClassLoader classloader)Auto detect instance ofAtmosphereHandlerin case META-INF/atmosphere.xml is missing.protected voidautoDetectContainer()Auto detect the underlying Servlet Container we are running on.protected voidautoDetectWebSocketHandler(javax.servlet.ServletContext servletContext, java.lang.ClassLoader classloader)Auto detect instance ofWebSocketHandlerin case META-INF/atmosphere.xml is missing.java.util.List<BroadcasterCacheListener>broadcasterCacheListeners()java.util.List<java.lang.String>broadcasterFilters()Return the list ofBroadcastFilters.AtmosphereFrameworkbroadcasterFilters(BroadcastFilter f)Add aBroadcastFilter.java.lang.StringbroadcasterLifeCyclePolicy()AtmosphereFrameworkbroadcasterLifeCyclePolicy(java.lang.String broadcasterLifeCyclePolicy)java.util.List<BroadcasterListener>broadcasterListeners()java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>broadcasterTypes()voidcheckWebSocketSupportState()protected voidcloseAtmosphereResource()protected voidconfigureAtmosphereInterceptor(javax.servlet.ServletConfig sc)Configure the list ofAtmosphereInterceptor.protected voidconfigureBroadcaster()voidconfigureBroadcasterFactory()protected voidconfigureDetectedFramework(ReflectorServletProcessor rsp, boolean isJersey)protected voidconfigureObjectFactory()protected java.util.Map<java.lang.String,java.lang.String>configureQueryStringAsRequest(AtmosphereRequest request)AtmosphereFrameworkconfigureRequestResponse(AtmosphereRequest req, AtmosphereResponse res)Configure some attributes on theAtmosphereRequest.protected voidconfigureScanningPackage(javax.servlet.ServletConfig sc, java.lang.String value)protected voidconfigureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc)protected AsyncSupportResolvercreateAsyncSupportResolver()Returns an instance of AsyncSupportResolverAsyncSupportResolver.protected AtmosphereFramework.AtmosphereHandlerWrappercreateWrapperAndConfigureHandler(AtmosphereHandler h, java.lang.String mapping, java.util.List<AtmosphereInterceptor> l)java.util.List<java.lang.String>customAnnotationPackages()Return the list of packages the framework should look forAtmosphereAnnotation.java.lang.Class<? extends AtmosphereInterceptor>[]defaultInterceptors()protected voiddefaultPackagesToScan()AtmosphereFrameworkdestroy()protected voiddestroyInterceptors()protected booleandetectSupportedFramework(javax.servlet.ServletConfig sc)Auto-detect Jersey when no atmosphere.xml file is specified.ActiondoCometSupport(AtmosphereRequest req, AtmosphereResponse res)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)EndpointMapper<AtmosphereFramework.AtmosphereHandlerWrapper>endPointMapper()The currentEndpointMapperused to map requests toAtmosphereHandler.AtmosphereFrameworkendPointMapper(EndpointMapper endpointMapper)Set theEndpointMapper.java.util.List<java.lang.String>excludedInterceptors()AtmosphereFrameworkexcludeInterceptor(java.lang.String interceptor)Exclude anAtmosphereInterceptorfrom being added, at startup, by Atmosphere.booleanexternalizeDestroy()AtmosphereFrameworkexternalizeDestroy(boolean externalizeDestroy)If set to true, the task of finishing the request/response lifecycle will not be handled by this class.AtmosphereFrameworkfilterManipulator(BroadcasterConfig.FilterManipulator m)java.util.List<BroadcasterConfig.FilterManipulator>filterManipulators()AtmosphereFrameworkframeworkListener(AtmosphereFrameworkListener l)java.util.List<AtmosphereFrameworkListener>frameworkListeners()Return the list ofAtmosphereFrameworkListenerAsyncSupportgetAsyncSupport()Return the currentAsyncSupport.AtmosphereConfiggetAtmosphereConfig()Return a configured instance ofAtmosphereConfig.java.lang.StringgetAtmosphereDotXmlPath()java.util.Map<java.lang.String,AtmosphereFramework.AtmosphereHandlerWrapper>getAtmosphereHandlers()java.lang.StringgetBroadcasterCacheClassName()Return theBroadcasterCacheclass name.BroadcasterFactorygetBroadcasterFactory()Get theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.AsyncSupportgetCometSupport()Deprecated.Use getAsyncSupportjava.lang.StringgetDefaultBroadcasterClassName()Return the defaultBroadcasterclass name.java.lang.Class<Serializer>getDefaultSerializerClass()Get the defaultSerializerclass to use forAtmosphereResources.java.lang.StringgetDefaultSerializerClassName()Get the defaultSerializerclass name to use forAtmosphereResources.java.lang.StringgetHandlersPath()java.lang.StringgetLibPath()Return the location of the JARs containing the application classes.javax.servlet.ServletConfiggetServletConfig()javax.servlet.ServletContextgetServletContext()Return theServletContextjava.lang.StringgetWebSocketProcessorClassName()The currentWebSocketProcessorused to handle websocket requests.WebSocketProtocolgetWebSocketProtocol()java.lang.StringgetWebSocketProtocolClassName()AtmosphereFrameworkinit()Initialize the AtmosphereFramework.AtmosphereFrameworkinit(javax.servlet.ServletConfig sc)Initialize the AtmosphereFramework using theServletContext.AtmosphereFrameworkinit(javax.servlet.ServletConfig sc, boolean wrap)Initialize the AtmosphereFramework using theServletContext.voidinitAtmosphereHandler()voidinitAtmosphereHandler(javax.servlet.ServletConfig sc)InitializeAtmosphereServletProcessor.voidinitEndpointMapper()voidinitializationError(java.lang.IllegalStateException initializationError)If aContainerInitializerfail, log the excetion here.booleaninitialized()Return true if theinit()has been sucessfully executed.voidinitWebSocket()java.util.concurrent.ConcurrentLinkedQueue<BroadcasterCacheInspector>inspectors()Return the list ofBroadcasterCacheInspectors.protected voidinstallAnnotationProcessor(javax.servlet.ServletConfig sc)AtmosphereFrameworkinterceptor(AtmosphereInterceptor c)Add anAtmosphereInterceptorimplementation.java.util.LinkedList<AtmosphereInterceptor>interceptors()Return the list ofAtmosphereInterceptor.booleanisAServletFilter()booleanisBroadcasterSpecified()Was aBroadcasterdefined in web.xml or programmatically added.booleanisDestroyed()Return true is thedestroy()method has been invoked.booleanisShareExecutorServices()Returns true ifExecutorServiceis shared among all components.booleanisUseBlockingImplementation()booleanisUseNativeImplementation()booleanisUseServlet30()booleanisUseStreamForFlushingComments()true if Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation.protected voidloadAtmosphereDotXml(java.io.InputStream stream, java.lang.ClassLoader c)Load AtmosphereHandler defined under META-INF/atmosphere.xml.voidloadAtmosphereHandlersFromPath(java.lang.ClassLoader classloader, java.lang.String realPath)voidloadConfiguration(javax.servlet.ServletConfig sc)protected voidloadMetaService()protected voidloadWebSocketFromPath(java.lang.ClassLoader classloader, java.lang.String realPath)protected java.lang.StringlookupDefaultBroadcasterType(java.lang.String defaultB)protected AtmosphereObjectFactory<?>lookupDefaultObjectFactoryType()java.lang.StringmappingRegex()AtmosphereFrameworkmappingRegex(java.lang.String mappingRegex)MetaBroadcastermetaBroadcaster()protected AtmosphereInterceptornewAInterceptor(java.lang.Class<? extends AtmosphereInterceptor> a)protected AtmosphereConfignewAtmosphereConfig()Create an instance ofAtmosphereConfig<T,U extends T>
TnewClassInstance(java.lang.Class<T> classType, java.lang.Class<U> defaultType)Instantiate a classjava.lang.StringnormalizePath(java.lang.String path)AtmosphereFrameworknotify(Action.TYPE type, AtmosphereRequest request, AtmosphereResponse response)AtmosphereFrameworknotifyDestroyed(java.lang.String uuid)AtmosphereFrameworknotifySuspended(java.lang.String uuid)AtmosphereObjectFactoryobjectFactory()voidobjectFactory(AtmosphereObjectFactory objectFactory)Set an object used for class instantiation.java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>objectFactoryType()protected voidonPostDestroy()protected voidonPostInit()protected voidonPreDestroy()protected voidonPreInit()java.util.List<java.lang.String>packages()voidpatchContainer()Path specific container using their own property.protected voidpreventOOM()Prevent Atmosphere from scanning the entire class path.protected voidreadSystemProperties()voidreconfigureInitParams(boolean reconfigureInitParams)AtmosphereFrameworkremoveAllAtmosphereHandler()Remove allAtmosphereHandlers.AtmosphereFrameworkremoveAllInitParams()Remove all init parameters.AtmosphereFrameworkremoveAtmosphereHandler(java.lang.String mapping)Remove anAtmosphereHandler.AtmosphereFrameworkresetStates()protected voidservletConfig(javax.servlet.ServletConfig sc, boolean wrap)AtmosphereResourceSessionFactorysessionFactory()Return theAtmosphereResourceSessionFactoryvoidsessionSupport(boolean sessionSupport)voidsetAndConfigureAtmosphereResourceFactory(AtmosphereResourceFactory arFactory)AtmosphereFrameworksetAsyncSupport(AsyncSupport asyncSupport)Set theAsyncSupportimplementation.AtmosphereFrameworksetAtmosphereDotXmlPath(java.lang.String atmosphereDotXmlPath)AtmosphereFrameworksetBroadcasterCacheClassName(java.lang.String broadcasterCacheClassName)Set theBroadcasterCacheclass name.AtmosphereFrameworksetBroadcasterFactory(BroadcasterFactory broadcasterFactory)Set theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.AtmosphereFrameworksetCometSupport(AsyncSupport asyncSupport)AtmosphereFrameworksetDefaultBroadcasterClassName(java.lang.String bccn)Set the defaultBroadcasterclass name.AtmosphereFrameworksetDefaultSerializerClassName(java.lang.String defaultSerializerClassName)Set the defaultSerializerclass name to use forAtmosphereResources.AtmosphereFrameworksetHandlersPath(java.lang.String handlersPath)AtmosphereFrameworksetLibPath(java.lang.String libPath)Set the location of the JARs containing the application.AtmosphereFrameworksetUseBlockingImplementation(boolean useBlockingImplementation)AtmosphereFrameworksetUseNativeImplementation(boolean useNativeImplementation)voidsetUseServlet30(boolean useServlet30)AtmosphereFrameworksetUseStreamForFlushingComments(boolean useStreamForFlushingComments)Set to true so Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation.AtmosphereFrameworksetWebsocketProcessorClassName(java.lang.String webSocketProcessorClassName)Set theWebSocketProcessorclass name used to process WebSocket requests.AtmosphereFrameworksetWebSocketProtocolClassName(java.lang.String webSocketProtocolClassName)booleansharedThreadPools()AtmosphereFrameworksharedThreadPools(boolean sharedThreadPools)AtmosphereFrameworkshareExecutorServices(boolean sharedThreadPools)Set to true to have aExecutorServiceshared among all components.protected voiduniverse()UUIDProvideruuidProvider()Return theUUIDProviderAtmosphereFrameworkuuidProvider(UUIDProvider uuidProvider)Set aUUIDlike implementation for generating random UUID StringbooleanwebSocketEnabled()AtmosphereFrameworkwebSocketEnabled(boolean webSocketEnabled)WebSocketFactorywebSocketFactory()Return theWebSocketFactoryAtmosphereFrameworkwebSocketFactory(WebSocketFactory webSocketFactory)Configure theWebSocketFactory
-
-
-
Field Detail
-
DEFAULT_ATMOSPHERE_CONFIG_PATH
public static final java.lang.String DEFAULT_ATMOSPHERE_CONFIG_PATH
- See Also:
- Constant Field Values
-
DEFAULT_LIB_PATH
public static final java.lang.String DEFAULT_LIB_PATH
- See Also:
- Constant Field Values
-
DEFAULT_HANDLER_PATH
public static final java.lang.String DEFAULT_HANDLER_PATH
- See Also:
- Constant Field Values
-
META_SERVICE
public static final java.lang.String META_SERVICE
- See Also:
- Constant Field Values
-
MAPPING_REGEX
public static final java.lang.String MAPPING_REGEX
- See Also:
- Constant Field Values
-
ASYNC_IO
public static final java.lang.String ASYNC_IO
- See Also:
- Constant Field Values
-
logger
protected static final org.slf4j.Logger logger
-
broadcasterFilters
protected final java.util.List<java.lang.String> broadcasterFilters
-
asyncSupportListeners
protected final java.util.List<AsyncSupportListener> asyncSupportListeners
-
atmosphereResourceListeners
protected final java.util.List<AtmosphereResourceListener> atmosphereResourceListeners
-
possibleComponentsCandidate
protected final java.util.ArrayList<java.lang.String> possibleComponentsCandidate
-
initParams
protected final java.util.HashMap<java.lang.String,java.lang.String> initParams
-
config
protected final AtmosphereConfig config
-
isCometSupportConfigured
protected final java.util.concurrent.atomic.AtomicBoolean isCometSupportConfigured
-
isFilter
protected final boolean isFilter
-
atmosphereHandlers
protected final java.util.Map<java.lang.String,AtmosphereFramework.AtmosphereHandlerWrapper> atmosphereHandlers
-
broadcasterTypes
protected final java.util.concurrent.ConcurrentLinkedQueue<java.lang.String> broadcasterTypes
-
objectFactoryType
protected final java.util.concurrent.ConcurrentLinkedQueue<java.lang.String> objectFactoryType
-
inspectors
protected final java.util.concurrent.ConcurrentLinkedQueue<BroadcasterCacheInspector> inspectors
-
mappingRegex
protected java.lang.String mappingRegex
-
useNativeImplementation
protected boolean useNativeImplementation
-
useBlockingImplementation
protected boolean useBlockingImplementation
-
useStreamForFlushingComments
protected boolean useStreamForFlushingComments
-
useServlet30
protected boolean useServlet30
-
asyncSupport
protected AsyncSupport asyncSupport
-
broadcasterClassName
protected java.lang.String broadcasterClassName
-
isCometSupportSpecified
protected boolean isCometSupportSpecified
-
isBroadcasterSpecified
protected boolean isBroadcasterSpecified
-
isSessionSupportSpecified
protected boolean isSessionSupportSpecified
-
isThrowExceptionOnClonedRequestSpecified
protected boolean isThrowExceptionOnClonedRequestSpecified
-
broadcasterFactory
protected BroadcasterFactory broadcasterFactory
-
broadcasterFactoryClassName
protected java.lang.String broadcasterFactoryClassName
-
broadcasterCacheClassName
protected java.lang.String broadcasterCacheClassName
-
webSocketEnabled
protected boolean webSocketEnabled
-
broadcasterLifeCyclePolicy
protected java.lang.String broadcasterLifeCyclePolicy
-
webSocketProtocolClassName
protected java.lang.String webSocketProtocolClassName
-
webSocketProtocol
protected WebSocketProtocol webSocketProtocol
-
handlersPath
protected java.lang.String handlersPath
-
servletConfig
protected javax.servlet.ServletConfig servletConfig
-
autoDetectHandlers
protected boolean autoDetectHandlers
-
atmosphereDotXmlPath
protected java.lang.String atmosphereDotXmlPath
-
metaServicePath
protected java.lang.String metaServicePath
-
interceptors
protected final java.util.LinkedList<AtmosphereInterceptor> interceptors
-
scanDone
protected boolean scanDone
-
annotationProcessorClassName
protected java.lang.String annotationProcessorClassName
-
broadcasterListeners
protected final java.util.List<BroadcasterListener> broadcasterListeners
-
webSocketProcessorClassName
protected java.lang.String webSocketProcessorClassName
-
webSocketProtocolInitialized
protected boolean webSocketProtocolInitialized
-
endpointMapper
protected EndpointMapper<AtmosphereFramework.AtmosphereHandlerWrapper> endpointMapper
-
libPath
protected java.lang.String libPath
-
isInit
protected boolean isInit
-
sharedThreadPools
protected boolean sharedThreadPools
-
packages
protected final java.util.List<java.lang.String> packages
-
annotationPackages
protected final java.util.LinkedList<java.lang.String> annotationPackages
-
allowAllClassesScan
protected boolean allowAllClassesScan
-
annotationFound
protected boolean annotationFound
-
executeFirstSet
protected boolean executeFirstSet
-
objectFactory
protected AtmosphereObjectFactory<?> objectFactory
-
isDestroyed
protected final java.util.concurrent.atomic.AtomicBoolean isDestroyed
-
externalizeDestroy
protected boolean externalizeDestroy
-
annotationProcessor
protected AnnotationProcessor annotationProcessor
-
excludedInterceptors
protected final java.util.List<java.lang.String> excludedInterceptors
-
broadcasterCacheListeners
protected final java.util.LinkedList<BroadcasterCacheListener> broadcasterCacheListeners
-
filterManipulators
protected final java.util.List<BroadcasterConfig.FilterManipulator> filterManipulators
-
arFactory
protected AtmosphereResourceFactory arFactory
-
metaBroadcaster
protected MetaBroadcaster metaBroadcaster
-
sessionFactory
protected AtmosphereResourceSessionFactory sessionFactory
-
defaultSerializerClassName
protected java.lang.String defaultSerializerClassName
-
defaultSerializerClass
protected java.lang.Class<Serializer> defaultSerializerClass
-
frameworkListeners
protected final java.util.List<AtmosphereFrameworkListener> frameworkListeners
-
shutdownHook
protected java.lang.Thread shutdownHook
-
DEFAULT_ATMOSPHERE_INTERCEPTORS
public static final java.util.List<java.lang.Class<? extends AtmosphereInterceptor>> DEFAULT_ATMOSPHERE_INTERCEPTORS
-
REFLECTOR_ATMOSPHEREHANDLER
public static final AtmosphereHandler REFLECTOR_ATMOSPHEREHANDLER
An implementation ofAbstractReflectorAtmosphereHandler.
-
-
Constructor Detail
-
AtmosphereFramework
public AtmosphereFramework()
Create an AtmosphereFramework.
-
AtmosphereFramework
public AtmosphereFramework(javax.servlet.ServletConfig sc) throws javax.servlet.ServletExceptionCreate 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 Detail
-
setAndConfigureAtmosphereResourceFactory
public void setAndConfigureAtmosphereResourceFactory(AtmosphereResourceFactory arFactory)
-
newAtmosphereConfig
protected AtmosphereConfig newAtmosphereConfig()
Create an instance ofAtmosphereConfig
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, java.util.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(java.lang.String mapping, AtmosphereHandler h, Broadcaster broadcaster, java.util.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(java.lang.String mapping, AtmosphereHandler h, java.lang.String broadcasterId, java.util.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, java.lang.String mapping, java.util.List<AtmosphereInterceptor> l)
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h)
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
public java.lang.String normalizePath(java.lang.String path)
-
addAtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(java.lang.String mapping, AtmosphereHandler h, java.lang.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(java.lang.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
public AtmosphereFramework removeAtmosphereHandler(java.lang.String mapping)
Remove anAtmosphereHandler.- Parameters:
mapping- the mapping used when invokingaddAtmosphereHandler(String, AtmosphereHandler);- Returns:
- true if removed
-
removeAllAtmosphereHandler
public AtmosphereFramework removeAllAtmosphereHandler()
Remove allAtmosphereHandlers.
-
removeAllInitParams
public AtmosphereFramework removeAllInitParams()
Remove all init parameters.
-
addInitParameter
public AtmosphereFramework addInitParameter(java.lang.String name, java.lang.String value)
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
public AtmosphereFramework 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
protected AtmosphereInterceptor newAInterceptor(java.lang.Class<? extends AtmosphereInterceptor> a)
-
configureWebDotXmlAtmosphereHandler
protected void configureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc)
-
configureScanningPackage
protected void configureScanningPackage(javax.servlet.ServletConfig sc, java.lang.String value)
-
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
protected boolean detectSupportedFramework(javax.servlet.ServletConfig sc) throws java.lang.ExceptionAuto-detect Jersey when no atmosphere.xml file is specified.- Parameters:
sc-ServletConfig- Returns:
- true if Jersey classes are detected
- Throws:
java.lang.ClassNotFoundExceptionjava.lang.Exception
-
configureDetectedFramework
protected void configureDetectedFramework(ReflectorServletProcessor rsp, boolean isJersey)
-
lookupDefaultBroadcasterType
protected java.lang.String lookupDefaultBroadcasterType(java.lang.String defaultB)
-
lookupDefaultObjectFactoryType
protected AtmosphereObjectFactory<?> lookupDefaultObjectFactoryType()
-
sessionSupport
public void sessionSupport(boolean sessionSupport)
-
initAtmosphereHandler
public void initAtmosphereHandler(javax.servlet.ServletConfig sc) throws javax.servlet.ServletExceptionInitializeAtmosphereServletProcessor.- 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
public AtmosphereFramework destroy()
-
destroyInterceptors
protected void destroyInterceptors()
-
resetStates
public AtmosphereFramework resetStates()
-
loadMetaService
protected void loadMetaService()
-
loadAtmosphereDotXml
protected void loadAtmosphereDotXml(java.io.InputStream stream, java.lang.ClassLoader c) throws java.io.IOException, javax.servlet.ServletExceptionLoad AtmosphereHandler defined under META-INF/atmosphere.xml.- Parameters:
stream- The input stream we read from.c- The classloader- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
setAsyncSupport
public AtmosphereFramework setAsyncSupport(AsyncSupport asyncSupport)
Set theAsyncSupportimplementation. Make sure you don't set an implementation that only works on some container. SeeBlockingIOCometSupportfor an example.- Parameters:
asyncSupport-
-
setCometSupport
public AtmosphereFramework setCometSupport(AsyncSupport asyncSupport)
- Parameters:
asyncSupport-- Returns:
-
getAsyncSupport
public AsyncSupport getAsyncSupport()
Return the currentAsyncSupport.- Returns:
- the current
AsyncSupport
-
getCometSupport
public AsyncSupport getCometSupport()
Deprecated.Use getAsyncSupportReturn the currentAsyncSupport.- Returns:
- the current
AsyncSupport
-
createAsyncSupportResolver
protected AsyncSupportResolver 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, java.lang.ClassLoader classloader) throws java.net.MalformedURLExceptionAuto detect instance ofAtmosphereHandlerin case META-INF/atmosphere.xml is missing.- Parameters:
servletContext-ServletContextclassloader-ClassLoaderto load the class.- Throws:
java.net.MalformedURLException
-
loadAtmosphereHandlersFromPath
public void loadAtmosphereHandlersFromPath(java.lang.ClassLoader classloader, java.lang.String realPath)
-
autoDetectWebSocketHandler
protected void autoDetectWebSocketHandler(javax.servlet.ServletContext servletContext, java.lang.ClassLoader classloader) throws java.net.MalformedURLExceptionAuto detect instance ofWebSocketHandlerin case META-INF/atmosphere.xml is missing.- Parameters:
servletContext-ServletContextclassloader-ClassLoaderto load the class.- Throws:
java.net.MalformedURLException
-
loadWebSocketFromPath
protected void loadWebSocketFromPath(java.lang.ClassLoader classloader, java.lang.String realPath)
-
configureRequestResponse
public AtmosphereFramework configureRequestResponse(AtmosphereRequest req, AtmosphereResponse res) throws java.io.UnsupportedEncodingException
Configure some attributes on theAtmosphereRequest.- Parameters:
req-AtmosphereRequest- Throws:
java.io.UnsupportedEncodingException
-
doCometSupport
public Action doCometSupport(AtmosphereRequest req, AtmosphereResponse res) throws java.io.IOException, javax.servlet.ServletException
Invoke the proprietaryAsyncSupport.- Parameters:
req-res-- Returns:
- an
Action - Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
getDefaultBroadcasterClassName
public java.lang.String getDefaultBroadcasterClassName()
Return the defaultBroadcasterclass name.- Returns:
- the broadcasterClassName
-
setDefaultBroadcasterClassName
public AtmosphereFramework setDefaultBroadcasterClassName(java.lang.String bccn)
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
public AtmosphereFramework setUseStreamForFlushingComments(boolean useStreamForFlushingComments)
Set to true so Atmosphere usesAtmosphereResponseImpl.getOutputStream()by default for write operation. Default is false.- Parameters:
useStreamForFlushingComments- the useStreamForFlushingComments to set
-
getBroadcasterFactory
public BroadcasterFactory getBroadcasterFactory()
Get theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.- Returns:
BroadcasterFactory
-
setBroadcasterFactory
public AtmosphereFramework setBroadcasterFactory(BroadcasterFactory broadcasterFactory)
Set theBroadcasterFactorywhich is used by Atmosphere to constructBroadcaster.- Returns:
BroadcasterFactory
-
getBroadcasterCacheClassName
public java.lang.String getBroadcasterCacheClassName()
Return theBroadcasterCacheclass name.- Returns:
- the
BroadcasterCacheclass name
-
setBroadcasterCacheClassName
public AtmosphereFramework setBroadcasterCacheClassName(java.lang.String broadcasterCacheClassName)
Set theBroadcasterCacheclass name.- Parameters:
broadcasterCacheClassName-
-
addBroadcasterType
public AtmosphereFramework addBroadcasterType(java.lang.String broadcasterTypeString)
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
public java.util.concurrent.ConcurrentLinkedQueue<java.lang.String> broadcasterTypes()
-
getWebSocketProtocolClassName
public java.lang.String getWebSocketProtocolClassName()
-
setWebSocketProtocolClassName
public AtmosphereFramework setWebSocketProtocolClassName(java.lang.String webSocketProtocolClassName)
-
getAtmosphereHandlers
public java.util.Map<java.lang.String,AtmosphereFramework.AtmosphereHandlerWrapper> getAtmosphereHandlers()
-
configureQueryStringAsRequest
protected java.util.Map<java.lang.String,java.lang.String> configureQueryStringAsRequest(AtmosphereRequest request)
-
getWebSocketProtocol
public WebSocketProtocol getWebSocketProtocol()
-
isUseNativeImplementation
public boolean isUseNativeImplementation()
-
setUseNativeImplementation
public AtmosphereFramework setUseNativeImplementation(boolean useNativeImplementation)
-
isUseBlockingImplementation
public boolean isUseBlockingImplementation()
-
setUseBlockingImplementation
public AtmosphereFramework setUseBlockingImplementation(boolean useBlockingImplementation)
-
getAtmosphereDotXmlPath
public java.lang.String getAtmosphereDotXmlPath()
-
setAtmosphereDotXmlPath
public AtmosphereFramework setAtmosphereDotXmlPath(java.lang.String atmosphereDotXmlPath)
-
getHandlersPath
public java.lang.String getHandlersPath()
-
setHandlersPath
public AtmosphereFramework setHandlersPath(java.lang.String handlersPath)
-
getLibPath
public java.lang.String 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
public AtmosphereFramework setLibPath(java.lang.String libPath)
Set the location of the JARs containing the application.- Parameters:
libPath- the location of the JARs containing the application.- Returns:
- this
-
getWebSocketProcessorClassName
public java.lang.String getWebSocketProcessorClassName()
The currentWebSocketProcessorused to handle websocket requests.- Returns:
WebSocketProcessor
-
setWebsocketProcessorClassName
public AtmosphereFramework setWebsocketProcessorClassName(java.lang.String webSocketProcessorClassName)
Set theWebSocketProcessorclass name used to process WebSocket requests. Default isDefaultWebSocketProcessor- Parameters:
webSocketProcessorClassName-WebSocketProcessor- Returns:
- this
-
interceptor
public AtmosphereFramework interceptor(AtmosphereInterceptor c)
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
protected void addInterceptorToAllWrappers(AtmosphereInterceptor c)
-
addInterceptorToWrapper
protected void addInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, AtmosphereInterceptor c)
-
addInterceptorToWrapper
protected void addInterceptorToWrapper(AtmosphereFramework.AtmosphereHandlerWrapper wrapper, java.util.List<AtmosphereInterceptor> interceptors)
-
interceptors
public java.util.LinkedList<AtmosphereInterceptor> interceptors()
Return the list ofAtmosphereInterceptor.- Returns:
- the list of
AtmosphereInterceptor
-
annotationProcessorClassName
public AtmosphereFramework annotationProcessorClassName(java.lang.String annotationProcessorClassName)
Set theAnnotationProcessorclass name.- Parameters:
annotationProcessorClassName- theAnnotationProcessorclass name.- Returns:
- this
-
asyncSupportListener
public AtmosphereFramework asyncSupportListener(AsyncSupportListener asyncSupportListener)
Add anAsyncSupportListener.- Parameters:
asyncSupportListener- anAsyncSupportListener- Returns:
- this;
-
asyncSupportListeners
public java.util.List<AsyncSupportListener> asyncSupportListeners()
Return the list ofAsyncSupportListeners.- Returns:
-
addBroadcasterListener
public AtmosphereFramework addBroadcasterListener(BroadcasterListener b)
AddBroadcasterListenerto all createdBroadcasters.
-
addBroadcasterCacheListener
public AtmosphereFramework addBroadcasterCacheListener(BroadcasterCacheListener b)
AddBroadcasterCacheListenerto theBroadcasterCache.
-
broadcasterCacheListeners
public java.util.List<BroadcasterCacheListener> broadcasterCacheListeners()
-
addBroadcasterCacheInjector
public AtmosphereFramework addBroadcasterCacheInjector(BroadcasterCacheInspector b)
Add aBroadcasterCacheInspectorwhich will be associated with the definedBroadcasterCache.- Parameters:
b-BroadcasterCacheInspector- Returns:
- this;
-
inspectors
public java.util.concurrent.ConcurrentLinkedQueue<BroadcasterCacheInspector> inspectors()
Return the list ofBroadcasterCacheInspectors.- Returns:
- the list of
BroadcasterCacheInspectors
-
getAtmosphereConfig
public AtmosphereConfig 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
public java.util.List<java.lang.String> broadcasterFilters()
Return the list ofBroadcastFilters.- Returns:
- the list of
BroadcastFilters
-
broadcasterFilters
public AtmosphereFramework broadcasterFilters(BroadcastFilter f)
Add aBroadcastFilter.- Returns:
-
isShareExecutorServices
public boolean isShareExecutorServices()
Returns true ifExecutorServiceis shared among all components.- Returns:
- true if
ExecutorServiceis shared amongst all components
-
shareExecutorServices
public AtmosphereFramework shareExecutorServices(boolean sharedThreadPools)
Set to true to have aExecutorServiceshared among all components.- Parameters:
sharedThreadPools-- Returns:
- this
-
autoConfigureService
protected void autoConfigureService(javax.servlet.ServletContext sc) throws java.io.IOException- Throws:
java.io.IOException
-
endPointMapper
public EndpointMapper<AtmosphereFramework.AtmosphereHandlerWrapper> endPointMapper()
The currentEndpointMapperused to map requests toAtmosphereHandler.- Returns:
EndpointMapper
-
endPointMapper
public AtmosphereFramework endPointMapper(EndpointMapper endpointMapper)
Set theEndpointMapper.- Parameters:
endpointMapper-EndpointMapper- Returns:
- this
-
addAnnotationPackage
public AtmosphereFramework addAnnotationPackage(java.lang.Class<?> clazz)
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
public AtmosphereFramework notifyDestroyed(java.lang.String uuid)
-
notifySuspended
public AtmosphereFramework notifySuspended(java.lang.String uuid)
-
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(WebSocketHandler handler)
Add anWebSocketHandlermapped to "/*". return this
-
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(java.lang.String path, WebSocketHandler handler)
Add anWebSocketHandlermapped to the path. return this
-
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(java.lang.String path, WebSocketHandler handler, AtmosphereHandler h)
- Parameters:
path- a pathhandler- aWebSocketHandlerh- anAtmosphereHandler- Returns:
- this
-
addWebSocketHandler
public AtmosphereFramework addWebSocketHandler(java.lang.String path, WebSocketHandler handler, AtmosphereHandler h, java.util.List<AtmosphereInterceptor> l)
- Parameters:
path- a pathhandler- aWebSocketHandlerh- anAtmosphereHandlerl-AtmosphereInterceptor- Returns:
- this
-
annotationScanned
public AtmosphereFramework annotationScanned(boolean b)
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
public java.util.List<java.lang.String> packages()
-
customAnnotationPackages
public java.util.List<java.lang.String> customAnnotationPackages()
Return the list of packages the framework should look forAtmosphereAnnotation.- Returns:
- the list of packages the framework should look for
AtmosphereAnnotation
-
addCustomAnnotationPackage
public AtmosphereFramework addCustomAnnotationPackage(java.lang.Class p)
Add a package containing classes annotated withAtmosphereAnnotation.- Parameters:
p- a package- Returns:
- this;
-
newClassInstance
public <T,U extends T> T newClassInstance(java.lang.Class<T> classType, java.lang.Class<U> defaultType) throws java.lang.InstantiationException, java.lang.IllegalAccessExceptionInstantiate a class- Parameters:
classType- The Required Class's TypedefaultType- The default implementation of the Class's Type.- Returns:
- the an instance of defaultType
- Throws:
java.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
objectFactory
public void objectFactory(AtmosphereObjectFactory objectFactory)
Set an object used for class instantiation. Allows for integration with dependency injection frameworks.- Parameters:
objectFactory-
-
externalizeDestroy
public AtmosphereFramework externalizeDestroy(boolean 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
public AnnotationProcessor 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
public AtmosphereFramework excludeInterceptor(java.lang.String interceptor)
Exclude anAtmosphereInterceptorfrom being added, at startup, by Atmosphere. The default'sDEFAULT_ATMOSPHERE_INTERCEPTORSare candidates for being excluded.- Parameters:
interceptor- anAtmosphereInterceptorclass name- Returns:
- this
-
filterManipulator
public AtmosphereFramework filterManipulator(BroadcasterConfig.FilterManipulator m)
-
filterManipulators
public java.util.List<BroadcasterConfig.FilterManipulator> filterManipulators()
-
isAServletFilter
public boolean isAServletFilter()
-
objectFactoryType
public java.util.concurrent.ConcurrentLinkedQueue<java.lang.String> objectFactoryType()
-
mappingRegex
public java.lang.String mappingRegex()
-
mappingRegex
public AtmosphereFramework mappingRegex(java.lang.String mappingRegex)
-
setUseServlet30
public void setUseServlet30(boolean useServlet30)
-
webSocketEnabled
public boolean webSocketEnabled()
-
webSocketEnabled
public AtmosphereFramework webSocketEnabled(boolean webSocketEnabled)
-
broadcasterLifeCyclePolicy
public java.lang.String broadcasterLifeCyclePolicy()
-
broadcasterLifeCyclePolicy
public AtmosphereFramework broadcasterLifeCyclePolicy(java.lang.String broadcasterLifeCyclePolicy)
-
broadcasterListeners
public java.util.List<BroadcasterListener> broadcasterListeners()
-
sharedThreadPools
public boolean sharedThreadPools()
-
sharedThreadPools
public AtmosphereFramework sharedThreadPools(boolean sharedThreadPools)
-
allowAllClassesScan
public boolean allowAllClassesScan()
-
allowAllClassesScan
public AtmosphereFramework allowAllClassesScan(boolean allowAllClassesScan)
-
objectFactory
public AtmosphereObjectFactory objectFactory()
-
externalizeDestroy
public boolean externalizeDestroy()
-
excludedInterceptors
public java.util.List<java.lang.String> excludedInterceptors()
-
defaultInterceptors
public java.lang.Class<? extends AtmosphereInterceptor>[] defaultInterceptors()
-
atmosphereFactory
public AtmosphereResourceFactory atmosphereFactory()
-
metaBroadcaster
public MetaBroadcaster metaBroadcaster()
-
getDefaultSerializerClassName
public java.lang.String getDefaultSerializerClassName()
Get the defaultSerializerclass name to use forAtmosphereResources.- Returns:
- the class name as a string, might be null if not configured
-
getDefaultSerializerClass
public java.lang.Class<Serializer> getDefaultSerializerClass()
Get the defaultSerializerclass to use forAtmosphereResources.- Returns:
- the class, might be null if not configured
-
setDefaultSerializerClassName
public AtmosphereFramework setDefaultSerializerClassName(java.lang.String defaultSerializerClassName)
Set the defaultSerializerclass name to use forAtmosphereResources.- Parameters:
defaultSerializerClassName- the class name to use- Returns:
- this
-
sessionFactory
public AtmosphereResourceSessionFactory 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
public AtmosphereFramework frameworkListener(AtmosphereFrameworkListener l)
- Parameters:
l-AtmosphereFrameworkListener- Returns:
- this;
-
frameworkListeners
public java.util.List<AtmosphereFrameworkListener> frameworkListeners()
Return the list ofAtmosphereFrameworkListener- Returns:
AtmosphereFrameworkListener
-
onPreInit
protected void onPreInit()
-
onPostInit
protected void onPostInit()
-
onPreDestroy
protected void onPreDestroy()
-
onPostDestroy
protected void onPostDestroy()
-
atmosphereResourceListeners
public java.util.List<AtmosphereResourceListener> atmosphereResourceListeners()
Return the list ofAtmosphereResourceListener- Returns:
- the list of
AtmosphereResourceListener
-
atmosphereResourceListener
public AtmosphereFramework atmosphereResourceListener(AtmosphereResourceListener atmosphereResourceListener)
- Parameters:
atmosphereResourceListener- aAtmosphereResourceListener- Returns:
- this
-
uuidProvider
public AtmosphereFramework uuidProvider(UUIDProvider uuidProvider)
Set aUUIDlike implementation for generating random UUID String- Parameters:
uuidProvider-- Returns:
- this
-
uuidProvider
public UUIDProvider uuidProvider()
Return theUUIDProvider- Returns:
UUIDProvider
-
webSocketFactory
public WebSocketFactory webSocketFactory()
Return theWebSocketFactory- Returns:
- the
WebSocketFactory
-
webSocketFactory
public AtmosphereFramework webSocketFactory(WebSocketFactory webSocketFactory)
Configure theWebSocketFactory- Parameters:
webSocketFactory- theWebSocketFactory- Returns:
- this
-
initializationError
public void initializationError(java.lang.IllegalStateException initializationError)
If aContainerInitializerfail, log the excetion here.- Parameters:
initializationError-
-
-