org.atmosphere.cpr
Class AsynchronousProcessor

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

public abstract class AsynchronousProcessor
extends Object
implements CometSupport<AtmosphereEventImpl>

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

Author:
Jeanfrancois Arcand

Field Summary
protected static String EVENT
           
protected  Logger logger
           
 
Constructor Summary
AsynchronousProcessor(AtmosphereServlet.AtmosphereConfig config)
           
 
Method Summary
 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.
 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
action, service
 

Field Detail

logger

protected final Logger logger

EVENT

protected static final String EVENT
See Also:
Constant Field Values
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<AtmosphereEventImpl>
Parameters:
sc - the ServletConfig
Throws:
ServletException

getContainerName

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

Specified by:
getContainerName in interface CometSupport<AtmosphereEventImpl>
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 Atmosphere#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

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 Atmosphere#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 Atmosphere#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 © 2009 SUN Microsystems. All Rights Reserved.