org.atmosphere.cpr
Class AsynchronousProcessor

java.lang.Object
  extended by org.atmosphere.cpr.AsynchronousProcessor
All Implemented Interfaces:
CometSupport<AtmosphereResourceImpl>
Direct Known Subclasses:
BlockingIOCometSupport, GlassFishv2CometSupport, GrizzlyCometSupport, JBossWebCometSupport, Jetty7CometSupport, JettyCometSupport, Servlet30Support, TomcatCometSupport, WebLogicCometSupport

public abstract class AsynchronousProcessor
extends Object
implements CometSupport<AtmosphereResourceImpl>

Base class which implement the semantics of supending and resuming of a Comet Request.

Author:
Jeanfrancois Arcand

Field Summary
protected  ConcurrentHashMap<HttpServletRequest,AtmosphereResource> aliveRequests
           
protected  Logger logger
           
protected static String RESOURCE_EVENT
           
static String SUPPORT_SESSION
           
 
Constructor Summary
AsynchronousProcessor(AtmosphereServlet.AtmosphereConfig config)
           
 
Method Summary
 void action(AtmosphereResourceImpl actionEvent)
          Process an AtmosphereServlet.Action from an ActionEvent operation like suspend, resume or timed out.
 AtmosphereServlet.Action cancelled(HttpServletRequest req, HttpServletResponse res)
          All proprietary Comet based Servlet must invoke the cancelled method when the underlying WebServer detect that the client closed the connection.
 String getContainerName()
          Return the container's name.
 void init(ServletConfig sc)
          Initialize the WebServer using the ServletConfig
 AtmosphereServlet.Action resumed(HttpServletRequest req, HttpServletResponse res)
          All proprietary Comet based Servlet must invoke the resume method when the Atmosphere's application decide to resume the HttpServletResponse.
protected  boolean supportSession()
          Is HttpSession supported
 AtmosphereServlet.Action suspended(HttpServletRequest req, HttpServletResponse res)
          All proprietary Comet based Servlet must invoke the suspended method when the first request comes in.
 AtmosphereServlet.Action timedout(HttpServletRequest req, HttpServletResponse res)
          All proprietary Comet based Servlet must invoke the timedout method when the underlying WebServer time out the HttpServletResponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.atmosphere.cpr.CometSupport
service
 

Field Detail

logger

protected final Logger logger

RESOURCE_EVENT

protected static final String RESOURCE_EVENT
See Also:
Constant Field Values

SUPPORT_SESSION

public static final String SUPPORT_SESSION
See Also:
Constant Field Values

aliveRequests

protected final ConcurrentHashMap<HttpServletRequest,AtmosphereResource> aliveRequests
Constructor Detail

AsynchronousProcessor

public AsynchronousProcessor(AtmosphereServlet.AtmosphereConfig config)
Method Detail

init

public void init(ServletConfig sc)
          throws ServletException
Description copied from interface: CometSupport
Initialize the WebServer using the ServletConfig

Specified by:
init in interface CometSupport<AtmosphereResourceImpl>
Parameters:
sc - the ServletConfig
Throws:
ServletException

supportSession

protected boolean supportSession()
Is HttpSession supported

Returns:
true if supported

getContainerName

public String getContainerName()
Return the container's name.

Specified by:
getContainerName in interface CometSupport<AtmosphereResourceImpl>
Returns:
the name of the Java Web Server.

suspended

public AtmosphereServlet.Action suspended(HttpServletRequest req,
                                          HttpServletResponse res)
                                   throws IOException,
                                          ServletException
All proprietary Comet based Servlet must invoke the suspended method when the first request comes in. The returned value, of type AtmosphereServlet.Action, tells the proprietary Comet Servlet to suspended or not the current HttpServletResponse.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
action the Action operation.
Throws:
IOException
ServletException

action

public void action(AtmosphereResourceImpl actionEvent)
Process an AtmosphereServlet.Action from an ActionEvent operation like suspend, resume or timed out.

Specified by:
action in interface CometSupport<AtmosphereResourceImpl>
Parameters:
actionEvent - An instance of AtmosphereServlet.Action

resumed

public AtmosphereServlet.Action resumed(HttpServletRequest req,
                                        HttpServletResponse res)
                                 throws IOException,
                                        ServletException
All proprietary Comet based Servlet must invoke the resume method when the Atmosphere's application decide to resume the HttpServletResponse. The returned value, of type AtmosphereServlet.Action, tells the proprietary Comet Servlet to resume (again), suspended or do nothing with the current HttpServletResponse.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
action the Action operation.
Throws:
IOException
ServletException

timedout

public AtmosphereServlet.Action timedout(HttpServletRequest req,
                                         HttpServletResponse res)
                                  throws IOException,
                                         ServletException
All proprietary Comet based Servlet must invoke the timedout method when the underlying WebServer time out the HttpServletResponse. The returned value, of type AtmosphereServlet.Action, tells the proprietary Comet Servlet to resume (again), suspended or do nothing with the current HttpServletResponse.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
action the Action operation.
Throws:
IOException
ServletException

cancelled

public AtmosphereServlet.Action cancelled(HttpServletRequest req,
                                          HttpServletResponse res)
                                   throws IOException,
                                          ServletException
All proprietary Comet based Servlet must invoke the cancelled method when the underlying WebServer detect that the client closed the connection.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
action the Action operation.
Throws:
IOException
ServletException


Copyright © 2010 SUN Microsystems. All Rights Reserved.