org.atmosphere.cpr
Class AtmosphereServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.atmosphere.cpr.AtmosphereServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, org.apache.catalina.comet.CometProcessor, ServletContextProvider, org.jboss.servlet.http.HttpEventServlet

public class AtmosphereServlet
extends javax.servlet.http.HttpServlet
implements org.apache.catalina.CometProcessor, org.jboss.servlet.http.HttpEventServlet, ServletContextProvider, org.apache.catalina.comet.CometProcessor

This servlet supports native Comet support with Tomcat 6, 7 and JBoss Web 3.x

Author:
Jeanfrancois Arcand
See Also:
Serialized Form

Field Summary
protected  AtmosphereFramework framework
           
protected static org.slf4j.Logger logger
           
 
Constructor Summary
AtmosphereServlet()
          Create an Atmosphere Servlet.
AtmosphereServlet(boolean isFilter)
          Create an Atmosphere Servlet.
AtmosphereServlet(boolean isFilter, boolean autoDetectHandlers)
          Create an Atmosphere Servlet.
 
Method Summary
 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)
           
 
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 org.atmosphere.di.ServletContextProvider
getServletContext
 
Methods inherited from interface javax.servlet.Servlet
getServletConfig, getServletInfo, service
 

Field Detail

logger

protected static final org.slf4j.Logger logger

framework

protected AtmosphereFramework framework
Constructor Detail

AtmosphereServlet

public AtmosphereServlet()
Create an Atmosphere Servlet.


AtmosphereServlet

public AtmosphereServlet(boolean isFilter)
Create an Atmosphere Servlet.

Parameters:
isFilter - true if this instance is used as an AtmosphereFilter

AtmosphereServlet

public AtmosphereServlet(boolean isFilter,
                         boolean autoDetectHandlers)
Create an Atmosphere Servlet.

Parameters:
isFilter - true if this instance is used as an AtmosphereFilter
Method Detail

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

init

public void init(javax.servlet.ServletConfig sc)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

framework

public AtmosphereFramework framework()

doHead

public void doHead(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws IOException,
                   javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doHead in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doOptions

public void doOptions(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse res)
               throws IOException,
                      javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doOptions in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doTrace

public void doTrace(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws IOException,
                    javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doTrace in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doDelete

public void doDelete(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse res)
              throws IOException,
                     javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doDelete in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doPut

public void doPut(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res)
           throws IOException,
                  javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doPut in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res)
           throws IOException,
                  javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws IOException,
                   javax.servlet.ServletException
Delegate the request processing to an instance of AsyncSupport

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

event

public void event(org.apache.catalina.CometEvent cometEvent)
           throws IOException,
                  javax.servlet.ServletException
Hack to support Tomcat AIO like other WebServer. This method is invoked by Tomcat when it detect a Servlet implements the interface CometProcessor without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)

Parameters:
cometEvent - the CometEvent
Throws:
IOException
javax.servlet.ServletException

event

public void event(org.apache.catalina.comet.CometEvent cometEvent)
           throws IOException,
                  javax.servlet.ServletException
Hack to support Tomcat 7 AIO

Specified by:
event in interface org.apache.catalina.comet.CometProcessor
Throws:
IOException
javax.servlet.ServletException

event

public void event(org.jboss.servlet.http.HttpEvent httpEvent)
           throws IOException,
                  javax.servlet.ServletException
Hack to support JBossWeb AIO like other WebServer. This method is invoked by Tomcat when it detect a Servlet implements the interface HttpEventServlet without invoking Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)

Specified by:
event in interface org.jboss.servlet.http.HttpEventServlet
Parameters:
httpEvent - the CometEvent
Throws:
IOException
javax.servlet.ServletException


Copyright © 2014. All Rights Reserved.