org.atmosphere.container
Class BlockingIOCometSupport

java.lang.Object
  extended by org.atmosphere.cpr.AsynchronousProcessor
      extended by org.atmosphere.container.BlockingIOCometSupport
All Implemented Interfaces:
CometSupport<AtmosphereResourceImpl>

public class BlockingIOCometSupport
extends AsynchronousProcessor

This class gets used when the AtmosphereServlet fails to autodetect the Servlet Container we are running on.

This CometSupport implementation uses a blocking approach, meaning the request thread will be blocked until another Thread invoke the Broadcaster.broadcast(T)

Author:
Jeanfrancois Arcand

Field Summary
protected static String LATCH
           
 
Fields inherited from class org.atmosphere.cpr.AsynchronousProcessor
aliveRequests, cancelledAction, config, timedoutAction
 
Constructor Summary
BlockingIOCometSupport(AtmosphereServlet.AtmosphereConfig config)
           
 
Method Summary
 void action(AtmosphereResourceImpl r)
          Process an AtmosphereServlet.Action from an ActionEvent operation like suspend, resume or timed out.
 AtmosphereServlet.Action cancelled(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          All proprietary Comet based Servlet must invoke the cancelled method when the underlying WebServer detect that the client closed the connection.
 AtmosphereServlet.Action service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Serve the HttpServletRequest and the HttpServletResponse and return the appropriate AtmosphereServlet.Action.
protected  void suspend(AtmosphereServlet.Action action, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Suspend the connection by blocking the current Thread
 
Methods inherited from class org.atmosphere.cpr.AsynchronousProcessor
destroyResource, getContainerName, init, map, resumed, shutdown, supportSession, supportWebSocket, suspended, timedout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LATCH

protected static final String LATCH
Constructor Detail

BlockingIOCometSupport

public BlockingIOCometSupport(AtmosphereServlet.AtmosphereConfig config)
Method Detail

service

public AtmosphereServlet.Action service(javax.servlet.http.HttpServletRequest req,
                                        javax.servlet.http.HttpServletResponse res)
                                 throws IOException,
                                        javax.servlet.ServletException
Serve the HttpServletRequest and the HttpServletResponse and return the appropriate AtmosphereServlet.Action.

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
the AtmosphereServlet.Action that was manipulated by the AtmosphereHandler
Throws:
IOException
javax.servlet.ServletException

suspend

protected void suspend(AtmosphereServlet.Action action,
                       javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
                throws IOException,
                       javax.servlet.ServletException
Suspend the connection by blocking the current Thread

Parameters:
action - The AtmosphereServlet.Action
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

cancelled

public AtmosphereServlet.Action cancelled(javax.servlet.http.HttpServletRequest req,
                                          javax.servlet.http.HttpServletResponse res)
                                   throws IOException,
                                          javax.servlet.ServletException
Description copied from class: AsynchronousProcessor
All proprietary Comet based Servlet must invoke the cancelled method when the underlying WebServer detect that the client closed the connection.

Overrides:
cancelled in class AsynchronousProcessor
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
action the Action operation.
Throws:
IOException
javax.servlet.ServletException

action

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

Specified by:
action in interface CometSupport<AtmosphereResourceImpl>
Overrides:
action in class AsynchronousProcessor
Parameters:
r - An instance of AtmosphereServlet.Action


Copyright © 2012. All Rights Reserved.