|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
weblogic.servlet.http.AbstractAsyncServlet
org.atmosphere.cpr.AtmosphereServlet
public class AtmosphereServlet
The 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>
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 |
AtmosphereServlet.Action
Simple class/struck that hold the current state. |
class |
AtmosphereServlet.AtmosphereConfig
|
static class |
AtmosphereServlet.AtmosphereHandlerWrapper
|
| Field Summary | |
|---|---|
protected Map<String,AtmosphereServlet.AtmosphereHandlerWrapper> |
atmosphereHandlers
The list of AtmosphereHandler and their associated mapping. |
static String |
BROADCASTER_TYPE
|
protected CometSupport |
cometSupport
|
protected AtmosphereServlet.AtmosphereConfig |
config
|
static String |
DISABLE_ONSTATE_EVENT
|
static String |
GAE_BROADCASTER
|
static String |
JERSEY_BROADCASTER
|
static String |
JERSEY_CONTAINER
|
static Logger |
logger
|
static String |
PRIMEFACES_SERVLET
|
static String |
PROPERTY_BLOCKING_COMETSUPPORT
|
static String |
PROPERTY_COMET_SUPPORT
|
static String |
PROPERTY_NATIVE_COMETSUPPORT
|
static String |
PROPERTY_SERVLET_MAPPING
|
static String |
PROPERTY_USE_STREAM
|
| Constructor Summary | |
|---|---|
AtmosphereServlet()
Create an Atmosphere Servlet. |
|
AtmosphereServlet(boolean isFilter)
Create an Atmosphere Servlet. |
|
| Method Summary | |
|---|---|
void |
addAtmosphereHandler(String mapping,
AtmosphereHandler h)
Add an AtmosphereHandler serviced by the Servlet
This API is exposed to allow embedding an Atmosphere application. |
void |
addInitParameter(String name,
String value)
Add init-param like if they were defined in web.xml |
protected void |
autoDetectAtmosphereHandlers(ServletContext sc,
URLClassLoader c)
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 CometSupportResolver |
createCometSupportResolver()
Returns an instance of CometSupportResolver CometSupportResolver |
void |
destroy()
|
protected boolean |
detectJerseyRuntime(ServletConfig sc)
Auto-detect Jersey when no atmosphere.xml file are specified. |
protected AtmosphereServlet.Action |
doCometSupport(HttpServletRequest req,
HttpServletResponse res)
Invoke the proprietary CometSupport |
void |
doDelete(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
void |
doGet(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
void |
doHead(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
protected void |
doInitParams(ServletConfig sc)
Read init param from web.xml and apply them. |
void |
doOptions(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
void |
doPost(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
void |
doPut(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
protected boolean |
doRequest(weblogic.servlet.http.RequestResponseKey rrk)
Weblogic specific comet based implementation. |
protected void |
doResponse(weblogic.servlet.http.RequestResponseKey rrk,
Object context)
Weblogic specific comet based implementation. |
protected void |
doTimeout(weblogic.servlet.http.RequestResponseKey rrk)
Weblogic specific comet based implementation. |
void |
doTrace(HttpServletRequest req,
HttpServletResponse res)
Delegate the request processing to an instance of CometSupport |
void |
event(org.apache.catalina.CometEvent cometEvent)
Hack to support Tomcat AIO like other WebServer. |
void |
event(org.jboss.servlet.http.HttpEvent httpEvent)
Hack to support JBossWeb AIO like other WebServer. |
CometSupport |
getCometSupport()
Return the current CometSupport |
String |
getDefaultBroadcasterClassName()
Return the default Broadcaster class name. |
void |
init(ServletConfig sc)
Load the AtmosphereHandler associated with this AtmosphereServlet. |
boolean |
isUseStreamForFlushingComments()
true if Atmosphere uses ServletResponse.getOutputStream()
by default for write operation. |
protected void |
loadAtmosphereDotXml(InputStream stream,
URLClassLoader c)
Load AtmosphereHandler defined under META-INF/atmosphere.xml |
protected void |
loadConfiguration(ServletConfig sc)
|
AtmosphereServlet.AtmosphereConfig |
newAtmosphereConfig(boolean supportSession)
Return a configured instance of AtmosphereServlet.AtmosphereConfig |
void |
setCometSupport(CometSupport cometSupport)
Set the CometSupport implementation. |
void |
setDefaultBroadcasterClassName(String broadcasterClassName)
Set the default Broadcaster class name |
void |
setUseStreamForFlushingComments(boolean useStreamForFlushingComments)
Set to true so Atmosphere uses ServletResponse.getOutputStream()
by default for write operation. |
| Methods inherited from class weblogic.servlet.http.AbstractAsyncServlet |
|---|
notify |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.servlet.Servlet |
|---|
getServletConfig, getServletInfo, service |
| Field Detail |
|---|
public static final String JERSEY_BROADCASTER
public static final String JERSEY_CONTAINER
public static final String GAE_BROADCASTER
public static final String PROPERTY_SERVLET_MAPPING
public static final String PROPERTY_BLOCKING_COMETSUPPORT
public static final String PROPERTY_NATIVE_COMETSUPPORT
public static final String PROPERTY_USE_STREAM
public static final String BROADCASTER_TYPE
public static final String PROPERTY_COMET_SUPPORT
public static final String PRIMEFACES_SERVLET
public static final String DISABLE_ONSTATE_EVENT
public static final Logger logger
protected Map<String,AtmosphereServlet.AtmosphereHandlerWrapper> atmosphereHandlers
AtmosphereHandler and their associated mapping.
protected CometSupport cometSupport
protected AtmosphereServlet.AtmosphereConfig config
| Constructor Detail |
|---|
public AtmosphereServlet()
public AtmosphereServlet(boolean isFilter)
| Method Detail |
|---|
public AtmosphereServlet.AtmosphereConfig newAtmosphereConfig(boolean supportSession)
AtmosphereServlet.AtmosphereConfig
supportSession - true if session is supported.
AtmosphereServlet.AtmosphereConfig
public void 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 void addInitParameter(String name,
String value)
name - The namevalue - The value
public void init(ServletConfig sc)
throws ServletException
AtmosphereHandler associated with this AtmosphereServlet.
init in interface Servletinit in class GenericServletsc - the ServletContext
ServletExceptionprotected void doInitParams(ServletConfig sc)
sc -
protected void loadConfiguration(ServletConfig sc)
throws ServletException
ServletExceptionprotected boolean detectJerseyRuntime(ServletConfig sc)
sc - ServletConfig
public void destroy()
destroy in interface Servletdestroy in class GenericServlet
protected void loadAtmosphereDotXml(InputStream stream,
URLClassLoader c)
throws IOException,
ServletException
IOException
ServletExceptionpublic void setCometSupport(CometSupport cometSupport)
CometSupport implementation. Make sure you don't set
an implementation that only works on some Container. See BlockingIOCometSupport
for an example.
cometSupport - public CometSupport getCometSupport()
CometSupport
protected CometSupportResolver createCometSupportResolver()
CometSupportResolver
protected void autoDetectContainer()
protected void autoDetectAtmosphereHandlers(ServletContext sc,
URLClassLoader c)
throws MalformedURLException,
URISyntaxException
AtmosphereHandler in case META-INF/atmosphere.xml
is missing.
sc - ServletContextc - URLClassLoader to load the class.
MalformedURLException
URISyntaxException
public void doHead(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doHead in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doOptions(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doOptions in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doTrace(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doTrace in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doDelete(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doDelete in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doPut(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doPut in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doGet in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
public void doPost(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
doPost in class HttpServletreq - the HttpServletRequestres - the HttpServletResponse
IOException
ServletException
protected AtmosphereServlet.Action doCometSupport(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
CometSupport
req - res -
IOException
ServletException
public void event(org.apache.catalina.CometEvent cometEvent)
throws IOException,
ServletException
Servlet implements the interface
CometProcessor without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
event in interface org.apache.catalina.CometProcessorevent in interface org.jboss.servlet.http.HttpEventServletcometEvent - the CometEvent
IOException
ServletException
public void event(org.jboss.servlet.http.HttpEvent httpEvent)
throws IOException,
ServletException
Servlet implements the interface
HttpEventServlet without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
httpEvent - the CometEvent
IOException
ServletException
protected boolean doRequest(weblogic.servlet.http.RequestResponseKey rrk)
throws IOException,
ServletException
doRequest in class weblogic.servlet.http.AbstractAsyncServletrrk -
IOException
ServletException
protected void doResponse(weblogic.servlet.http.RequestResponseKey rrk,
Object context)
throws IOException,
ServletException
doResponse in class weblogic.servlet.http.AbstractAsyncServletrrk -
IOException
ServletException
protected void doTimeout(weblogic.servlet.http.RequestResponseKey rrk)
throws IOException,
ServletException
doTimeout in class weblogic.servlet.http.AbstractAsyncServletrrk -
IOException
ServletExceptionpublic String getDefaultBroadcasterClassName()
Broadcaster class name.
public void setDefaultBroadcasterClassName(String broadcasterClassName)
Broadcaster class name
broadcasterClassName - the broadcasterClassName to setpublic boolean isUseStreamForFlushingComments()
ServletResponse.getOutputStream()
by default for write operation.
public void setUseStreamForFlushingComments(boolean useStreamForFlushingComments)
ServletResponse.getOutputStream()
by default for write operation. Default is false.
useStreamForFlushingComments - the useStreamForFlushingComments to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||