|
||||||||||
| 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 acts as a dispatcher for AtmosphereHandler
defined in META-INF/atmosphere.xml, or if atmosphere.xml is missing, all classes
that implements AtmosphereHandler will be discovered and mapped using
the class's name.
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>
You can force this framework to use one Thread per connection instead of
native API of the Web Server you are deploying on by adding
<init-param>
<param-name>org.atmosphere.useBlocking</param-name>
<param-value>true</param-value>
</init-param>
You can also define Broadcasterby adding:
<init-param>
<param-name>org.atmosphere.cpr.broadcasterClass</param-name>
<param-value>class-name</param-value>
</init-param>
You can also for Atmosphere to use OutputStream for all write operations.
<init-param>
<param-name>org.atmosphere.useStream</param-name>
<param-value>true</param-value>
</init-param>
You can also configure BroadcasterCache that persist message when Browser is disconnected.
<init-param>
<param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
<param-value>class-name</param-value>
</init-param>
You can also configure Atmosphere to use http session or not
<init-param>
<param-name>org.atmosphere.cpr.sessionSupport</param-name>
<param-value>false</param-value>
</init-param>
You can also configure BroadcastFilter that will be applied at all newly created Broadcaster
<init-param>
<param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name>
<param-value>BroadcastFilter class name separated by coma</param-value>
</init-param>
All the property available are defined in ApplicationConfig
The Atmosphere Framework can also be used as a Servlet Filter (AtmosphereFilter).
If you are planning to use JSP, Servlet or JSF, you can instead use the
MeteorServlet, which allow the use of Meteor inside those
components.
| Nested Class Summary | |
|---|---|
static class |
AtmosphereFramework.Action
Simple class/struck that hold the current state. |
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 |
configureBroadcaster(javax.servlet.ServletContext sc)
|
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. |
AtmosphereFramework.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 |
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()
Return the current AsyncSupport |
String |
getDefaultBroadcasterClassName()
Return the default Broadcaster class name. |
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()
|
protected boolean |
isIECandidate(AtmosphereRequest request)
|
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()
|
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. |
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 |
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 |
|---|
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
| 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 AtmosphereFramework init(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
AtmosphereHandler associated with this AtmosphereServlet.
sc - the ServletContext
javax.servlet.ServletExceptionprotected void configureWebDotXmlAtmosphereHandler(javax.servlet.ServletConfig sc)
protected void configureBroadcaster(javax.servlet.ServletContext sc)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
ClassNotFoundException
InstantiationException
IllegalAccessExceptionprotected 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 AtmosphereFramework.Action doCometSupport(AtmosphereRequest req,
AtmosphereResponse res)
throws IOException,
javax.servlet.ServletException
AsyncSupport
req - res -
AtmosphereFramework.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
BroadcasterFactory
public AtmosphereFramework setBroadcasterFactory(BroadcasterFactory broadcasterFactory)
throws IllegalAccessException,
InstantiationException,
ClassNotFoundException
BroadcasterFactory which is used by Atmosphere to construct
Broadcaster
BroadcasterFactory
IllegalAccessException
InstantiationException
ClassNotFoundExceptionpublic String getBroadcasterCacheClassName()
BroadcasterCache class name.
BroadcasterCache class name.
public void setBroadcasterCacheClassName(String broadcasterCacheClassName)
throws IllegalAccessException,
InstantiationException,
ClassNotFoundException
BroadcasterCache class name.
broadcasterCacheClassName -
IllegalAccessException
InstantiationException
ClassNotFoundExceptionpublic 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||