|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cpr.AtmosphereFramework
public class 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();
| Nested Class Summary | |
|---|---|
static class |
AtmosphereFramework.AtmosphereHandlerWrapper
|
| Constructor Summary | |
|---|---|
AtmosphereFramework()
Create an AtmosphereFramework. |
|
AtmosphereFramework(boolean isFilter,
boolean autoDetectHandlers)
Create an AtmosphereFramework. |
|
AtmosphereFramework(javax.servlet.ServletConfig sc)
Create an AtmosphereFramework and initialize it via init(javax.servlet.ServletConfig) |
|
| Method Summary | |
|---|---|
AtmosphereFramework |
addAtmosphereHandler(String mapping,
AtmosphereHandler h)
Add an AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application. |
AtmosphereFramework |
addAtmosphereHandler(String mapping,
AtmosphereHandler h,
Broadcaster broadcaster)
Add an AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application. |
AtmosphereFramework |
addAtmosphereHandler(String mapping,
AtmosphereHandler h,
String broadcasterId)
Add an AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application. |
AtmosphereFramework |
addBroadcasterType(String broadcasterTypeString)
Add a new Broadcaster class name AtmosphereServlet can use when initializing requests, and when atmosphere.xml broadcaster element is unspecified. |
AtmosphereFramework |
addInitParameter(String name,
String value)
Add init-param like if they were defined in web.xml |
void |
autoDetectAtmosphereHandlers(javax.servlet.ServletContext servletContext,
URLClassLoader classloader)
Auto detect instance of AtmosphereHandler in case META-INF/atmosphere.xml
is missing. |
protected void |
autoDetectContainer()
Auto detect the underlying Servlet Container we are running on. |
protected void |
autoDetectWebSocketHandler(javax.servlet.ServletContext servletContext,
URLClassLoader classloader)
Auto detect instance of WebSocketHandler in case META-INF/atmosphere.xml
is missing. |
List<String> |
broadcasterFilters()
|
protected void |
configureAtmosphereInterceptor(javax.servlet.ServletConfig sc)
Configure the list of AtmosphereInterceptor. |
protected void |
configureBroadcaster()
|
protected Map<String,String> |
configureQueryStringAsRequest(AtmosphereRequest request)
|
protected void |
configureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc)
|
protected AsyncSupportResolver |
createAsyncSupportResolver()
Returns an instance of AsyncSupportResolver AsyncSupportResolver |
AtmosphereFramework |
destroy()
|
protected boolean |
detectSupportedFramework(javax.servlet.ServletConfig sc)
Auto-detect Jersey when no atmosphere.xml file are specified. |
Action |
doCometSupport(AtmosphereRequest req,
AtmosphereResponse res)
Invoke the proprietary AsyncSupport |
protected void |
doInitParams(javax.servlet.ServletConfig sc)
Read init param from web.xml and apply them. |
protected void |
doInitParamsForWebSocket(javax.servlet.ServletConfig sc)
|
AsyncSupport |
getAsyncSupport()
Return the current AsyncSupport |
AtmosphereConfig |
getAtmosphereConfig()
Return a configured instance of AtmosphereConfig |
String |
getAtmosphereDotXmlPath()
|
Map<String,AtmosphereFramework.AtmosphereHandlerWrapper> |
getAtmosphereHandlers()
|
String |
getBroadcasterCacheClassName()
Return the BroadcasterCache class name. |
BroadcasterFactory |
getBroadcasterFactory()
Get the BroadcasterFactory which is used by Atmosphere to construct
Broadcaster |
AsyncSupport |
getCometSupport()
Deprecated. Use getAsyncSupport |
String |
getDefaultBroadcasterClassName()
Return the default Broadcaster class name. |
String |
getHandlersPath()
|
javax.servlet.ServletConfig |
getServletConfig()
|
javax.servlet.ServletContext |
getServletContext()
|
WebSocketProtocol |
getWebSocketProtocol()
|
String |
getWebSocketProtocolClassName()
|
AtmosphereFramework |
init(javax.servlet.ServletConfig sc)
Load the AtmosphereHandler associated with this AtmosphereServlet. |
protected void |
initWebSocketProtocol()
|
AtmosphereFramework |
interceptor(AtmosphereInterceptor c)
Add an AtmosphereInterceptor implementation. |
LinkedList<AtmosphereInterceptor> |
interceptors()
Return the list of AtmosphereInterceptor |
protected boolean |
isIECandidate(AtmosphereRequest request)
|
boolean |
isUseBlockingImplementation()
|
boolean |
isUseNativeImplementation()
|
boolean |
isUseStreamForFlushingComments()
true if Atmosphere uses AtmosphereResponse.getOutputStream()
by default for write operation. |
protected void |
loadAtmosphereDotXml(InputStream stream,
URLClassLoader c)
Load AtmosphereHandler defined under META-INF/atmosphere.xml |
void |
loadAtmosphereHandlersFromPath(URLClassLoader classloader,
String realPath)
|
void |
loadConfiguration(javax.servlet.ServletConfig sc)
|
protected void |
loadWebSocketFromPath(URLClassLoader classloader,
String realPath)
|
protected String |
lookupDefaultBroadcasterType()
|
void |
patchContainer()
Path specific container using their own property. |
protected void |
readSystemProperties()
|
AtmosphereFramework |
removeAllAtmosphereHandler()
Remove all AtmosphereHandler |
AtmosphereFramework |
removeAllInitParams()
Remove all init parameters. |
AtmosphereFramework |
removeAtmosphereHandler(String mapping)
Remove an AtmosphereHandler |
protected void |
sessionSupport(boolean sessionSupport)
|
AtmosphereFramework |
setAsyncSupport(AsyncSupport asyncSupport)
Set the AsyncSupport implementation. |
AtmosphereFramework |
setAtmosphereDotXmlPath(String atmosphereDotXmlPath)
|
void |
setBroadcasterCacheClassName(String broadcasterCacheClassName)
Set the BroadcasterCache class name. |
AtmosphereFramework |
setBroadcasterFactory(BroadcasterFactory broadcasterFactory)
Set the BroadcasterFactory which is used by Atmosphere to construct
Broadcaster |
AtmosphereFramework |
setCometSupport(AsyncSupport asyncSupport)
|
AtmosphereFramework |
setDefaultBroadcasterClassName(String bccn)
Set the default Broadcaster class name |
AtmosphereFramework |
setHandlersPath(String handlersPath)
|
AtmosphereFramework |
setUseBlockingImplementation(boolean useBlockingImplementation)
|
AtmosphereFramework |
setUseNativeImplementation(boolean useNativeImplementation)
|
AtmosphereFramework |
setUseStreamForFlushingComments(boolean useStreamForFlushingComments)
Set to true so Atmosphere uses AtmosphereResponse.getOutputStream()
by default for write operation. |
AtmosphereFramework |
setWebSocketProtocolClassName(String webSocketProtocolClassName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_ATMOSPHERE_CONFIG_PATH
protected static final org.slf4j.Logger logger
protected final List<String> broadcasterFilters
protected final ArrayList<String> possibleComponentsCandidate
protected final HashMap<String,String> initParams
protected final AtmosphereConfig config
protected final AtomicBoolean isCometSupportConfigured
protected final boolean isFilter
protected final Map<String,AtmosphereFramework.AtmosphereHandlerWrapper> atmosphereHandlers
protected final ConcurrentLinkedQueue<String> broadcasterTypes
protected boolean useNativeImplementation
protected boolean useBlockingImplementation
protected boolean useStreamForFlushingComments
protected AsyncSupport asyncSupport
protected String broadcasterClassName
protected boolean isCometSupportSpecified
protected boolean isBroadcasterSpecified
protected boolean isSessionSupportSpecified
protected BroadcasterFactory broadcasterFactory
protected String broadcasterFactoryClassName
protected static String broadcasterCacheClassName
protected boolean webSocketEnabled
protected String broadcasterLifeCyclePolicy
protected String webSocketProtocolClassName
protected WebSocketProtocol webSocketProtocol
protected String handlersPath
protected javax.servlet.ServletConfig servletConfig
protected boolean autoDetectHandlers
protected String atmosphereDotXmlPath
protected final LinkedList<AtmosphereInterceptor> interceptors
protected boolean scanDone
| Constructor Detail |
|---|
public AtmosphereFramework()
public AtmosphereFramework(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
init(javax.servlet.ServletConfig)
javax.servlet.ServletException
public AtmosphereFramework(boolean isFilter,
boolean autoDetectHandlers)
isFilter - true if this instance is used as an AtmosphereFilter| Method Detail |
|---|
public javax.servlet.ServletContext getServletContext()
getServletContext in interface ServletContextProviderpublic javax.servlet.ServletConfig getServletConfig()
public List<String> broadcasterFilters()
public AtmosphereConfig getAtmosphereConfig()
AtmosphereConfig
AtmosphereConfig
public AtmosphereFramework addAtmosphereHandler(String mapping,
AtmosphereHandler h)
AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application.
mapping - The servlet mapping (servlet path)h - implementation of an AtmosphereHandler
public AtmosphereFramework addAtmosphereHandler(String mapping,
AtmosphereHandler h,
String broadcasterId)
AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application.
mapping - The servlet mapping (servlet path)h - implementation of an AtmosphereHandlerbroadcasterId - The Broadcaster.getID() value.
public AtmosphereFramework addAtmosphereHandler(String mapping,
AtmosphereHandler h,
Broadcaster broadcaster)
AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application.
mapping - The servlet mapping (servlet path)h - implementation of an AtmosphereHandlerbroadcaster - The Broadcaster associated with AtmosphereHandler.public AtmosphereFramework removeAtmosphereHandler(String mapping)
AtmosphereHandler
mapping - the mapping used when invoking addAtmosphereHandler(String, AtmosphereHandler);
public AtmosphereFramework removeAllAtmosphereHandler()
AtmosphereHandler
public AtmosphereFramework removeAllInitParams()
public AtmosphereFramework addInitParameter(String name,
String value)
name - The namevalue - The valueprotected void readSystemProperties()
public void patchContainer()
public AtmosphereFramework init(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
AtmosphereHandler associated with this AtmosphereServlet.
sc - the ServletContext
javax.servlet.ServletExceptionprotected void configureAtmosphereInterceptor(javax.servlet.ServletConfig sc)
AtmosphereInterceptor.
sc - a ServletConfigprotected void configureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc)
protected void configureBroadcaster()
protected void doInitParamsForWebSocket(javax.servlet.ServletConfig sc)
protected void doInitParams(javax.servlet.ServletConfig sc)
sc - ServletConfig
public void loadConfiguration(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
javax.servlet.ServletException
protected boolean detectSupportedFramework(javax.servlet.ServletConfig sc)
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException,
NoSuchMethodException,
InvocationTargetException
sc - ServletConfig
ClassNotFoundException
IllegalAccessException
InstantiationException
NoSuchMethodException
InvocationTargetExceptionprotected String lookupDefaultBroadcasterType()
protected void sessionSupport(boolean sessionSupport)
protected void initWebSocketProtocol()
public AtmosphereFramework destroy()
protected void loadAtmosphereDotXml(InputStream stream,
URLClassLoader c)
throws IOException,
javax.servlet.ServletException
stream - The input stream we read from.c - The classloader
IOException
javax.servlet.ServletExceptionpublic AtmosphereFramework setAsyncSupport(AsyncSupport asyncSupport)
AsyncSupport implementation. Make sure you don't set
an implementation that only works on some Container. See BlockingIOCometSupport
for an example.
asyncSupport - public AtmosphereFramework setCometSupport(AsyncSupport asyncSupport)
asyncSupport -
public AsyncSupport getAsyncSupport()
AsyncSupport
AsyncSupportpublic AsyncSupport getCometSupport()
AsyncSupport
AsyncSupportprotected AsyncSupportResolver createAsyncSupportResolver()
AsyncSupportResolver
protected void autoDetectContainer()
public void autoDetectAtmosphereHandlers(javax.servlet.ServletContext servletContext,
URLClassLoader classloader)
throws MalformedURLException,
URISyntaxException
AtmosphereHandler in case META-INF/atmosphere.xml
is missing.
servletContext - ServletContextclassloader - URLClassLoader to load the class.
MalformedURLException
URISyntaxException
public void loadAtmosphereHandlersFromPath(URLClassLoader classloader,
String realPath)
protected void autoDetectWebSocketHandler(javax.servlet.ServletContext servletContext,
URLClassLoader classloader)
throws MalformedURLException,
URISyntaxException
WebSocketHandler in case META-INF/atmosphere.xml
is missing.
servletContext - ServletContextclassloader - URLClassLoader to load the class.
MalformedURLException
URISyntaxException
protected void loadWebSocketFromPath(URLClassLoader classloader,
String realPath)
public Action doCometSupport(AtmosphereRequest req,
AtmosphereResponse res)
throws IOException,
javax.servlet.ServletException
AsyncSupport
req - res -
Action
IOException
javax.servlet.ServletExceptionpublic String getDefaultBroadcasterClassName()
Broadcaster class name.
public AtmosphereFramework setDefaultBroadcasterClassName(String bccn)
Broadcaster class name
bccn - the broadcasterClassName to setpublic boolean isUseStreamForFlushingComments()
AtmosphereResponse.getOutputStream()
by default for write operation.
public AtmosphereFramework setUseStreamForFlushingComments(boolean useStreamForFlushingComments)
AtmosphereResponse.getOutputStream()
by default for write operation. Default is false.
useStreamForFlushingComments - the useStreamForFlushingComments to setpublic BroadcasterFactory getBroadcasterFactory()
BroadcasterFactory which is used by Atmosphere to construct
Broadcaster
BroadcasterFactorypublic AtmosphereFramework setBroadcasterFactory(BroadcasterFactory broadcasterFactory)
BroadcasterFactory which is used by Atmosphere to construct
Broadcaster
BroadcasterFactorypublic String getBroadcasterCacheClassName()
BroadcasterCache class name.
BroadcasterCache class name.public void setBroadcasterCacheClassName(String broadcasterCacheClassName)
BroadcasterCache class name.
broadcasterCacheClassName - public AtmosphereFramework addBroadcasterType(String broadcasterTypeString)
broadcasterTypeString - public String getWebSocketProtocolClassName()
public AtmosphereFramework setWebSocketProtocolClassName(String webSocketProtocolClassName)
public Map<String,AtmosphereFramework.AtmosphereHandlerWrapper> getAtmosphereHandlers()
protected Map<String,String> configureQueryStringAsRequest(AtmosphereRequest request)
protected boolean isIECandidate(AtmosphereRequest request)
public WebSocketProtocol getWebSocketProtocol()
public boolean isUseNativeImplementation()
public AtmosphereFramework setUseNativeImplementation(boolean useNativeImplementation)
public boolean isUseBlockingImplementation()
public AtmosphereFramework setUseBlockingImplementation(boolean useBlockingImplementation)
public String getAtmosphereDotXmlPath()
public AtmosphereFramework setAtmosphereDotXmlPath(String atmosphereDotXmlPath)
public String getHandlersPath()
public AtmosphereFramework setHandlersPath(String handlersPath)
public AtmosphereFramework interceptor(AtmosphereInterceptor c)
AtmosphereInterceptor implementation. The adding order or AtmosphereInterceptor will be used, e.g
the first added AtmosphereInterceptor will always be called first.
c - AtmosphereInterceptor
public LinkedList<AtmosphereInterceptor> interceptors()
AtmosphereInterceptor
AtmosphereInterceptor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||