The {@link AtmosphereServlet} acts as a dispatcher for {@link AtmosphereHandler}defined in META-INF/atmosphere.xml, or if atmosphere.xml is missing, all classes that implements {@link AtmosphereHandler} will be discovered and mapped usingthe class's name.
This {@link Servlet} can be defined inside an application's web.xml using the following:
<servlet> <description>AtmosphereServlet</description> <servlet-name>AtmosphereServlet</servlet-name> <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class> <load-on-startup>0 </load-on-startup> </servlet> <servlet-mapping> <servlet-name>AtmosphereServlet</servlet-name> <url-pattern>/Atmosphere </url-pattern> </servlet-mapping>
You can force this Servlet to use native API of the Web Server instead of the Servlet 3.0 Async API you are deploying on by adding
<init-param> <param-name>org.atmosphere.useNative</param-name> <param-value>true</param-value> </init-param>
You can force this Servlet 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 {@link Broadcaster}by 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 {@link java.io.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 {@link org.atmosphere.cpr.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 {@link BroadcastFilter} that will be applied at all newly created {@link Broadcaster}
<init-param> <param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name> <param-value>BroadcastFilter class name separated by coma</param-value> </init-param>
The Atmosphere Framework can also be used as a Servlet Filter ( {@link AtmosphereFilter}).
If you are planning to use JSP, Servlet or JSF, you can instead use the {@link MeteorServlet}, which allow the use of {@link Meteor} inside thosecomponents.
@author Jeanfrancois Arcand