public class AtmosphereServlet extends javax.servlet.http.HttpServlet implements org.apache.catalina.CometProcessor, org.jboss.servlet.http.HttpEventServlet, ServletContextProvider, org.apache.catalina.comet.CometProcessor
AtmosphereServlet 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.
This 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 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.| Modifier and Type | Field and Description |
|---|---|
protected AtmosphereFramework |
framework |
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
AtmosphereServlet()
Create an Atmosphere Servlet.
|
AtmosphereServlet(boolean isFilter)
Create an Atmosphere Servlet.
|
AtmosphereServlet(boolean isFilter,
boolean autoDetectHandlers)
Create an Atmosphere Servlet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
doTrace(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Delegate the request processing to an instance of
AsyncSupport |
void |
event(org.apache.catalina.CometEvent cometEvent)
Hack to support Tomcat AIO like other WebServer.
|
void |
event(org.apache.catalina.comet.CometEvent cometEvent)
Hack to support Tomcat 7 AIO
|
void |
event(org.jboss.servlet.http.HttpEvent httpEvent)
Hack to support JBossWeb AIO like other WebServer.
|
AtmosphereFramework |
framework() |
void |
init(javax.servlet.ServletConfig sc) |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, logclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetServletContextprotected static final org.slf4j.Logger logger
protected AtmosphereFramework framework
public AtmosphereServlet()
public AtmosphereServlet(boolean isFilter)
isFilter - true if this instance is used as an AtmosphereFilterpublic AtmosphereServlet(boolean isFilter,
boolean autoDetectHandlers)
isFilter - true if this instance is used as an AtmosphereFilterpublic void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletpublic void init(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic AtmosphereFramework framework()
public void doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoHead in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoOptions in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doTrace(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoTrace in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoDelete in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoPut in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoGet in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
AsyncSupportdoPost in class javax.servlet.http.HttpServletreq - the HttpServletRequestres - the HttpServletResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic void event(org.apache.catalina.CometEvent cometEvent)
throws java.io.IOException,
javax.servlet.ServletException
Servlet implements the interface
CometProcessor without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)cometEvent - the CometEventjava.io.IOExceptionjavax.servlet.ServletExceptionpublic void event(org.apache.catalina.comet.CometEvent cometEvent)
throws java.io.IOException,
javax.servlet.ServletException
event in interface org.apache.catalina.comet.CometProcessorjava.io.IOExceptionjavax.servlet.ServletExceptionpublic void event(org.jboss.servlet.http.HttpEvent httpEvent)
throws java.io.IOException,
javax.servlet.ServletException
Servlet implements the interface
HttpEventServlet without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)event in interface org.jboss.servlet.http.HttpEventServlethttpEvent - the CometEventjava.io.IOExceptionjavax.servlet.ServletExceptionCopyright © 2018. All Rights Reserved.