|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cpr.AsynchronousProcessor
public abstract class AsynchronousProcessor
Base class which implement the semantics of suspending and resuming of a Comet/WebSocket Request.
| Nested Class Summary | |
|---|---|
static class |
AsynchronousProcessor.AsynchronousProcessorHook
A callback class that can be used by Framework integrator to handle the close/timedout/resume life cycle of an AtmosphereResource. |
| Field Summary | |
|---|---|
protected ConcurrentHashMap<AtmosphereRequest,AtmosphereResource> |
aliveRequests
|
protected static Action |
cancelledAction
|
protected AtmosphereConfig |
config
|
protected static Action |
timedoutAction
|
| Constructor Summary | |
|---|---|
AsynchronousProcessor(AtmosphereConfig config)
|
|
| Method Summary | |
|---|---|
void |
action(AtmosphereResourceImpl r)
Process an Action from an ActionEvent operation like suspend, resume or timed out. |
Action |
cancelled(AtmosphereRequest req,
AtmosphereResponse res)
All proprietary Comet based Servlet must invoke the cancelled method when the underlying WebServer
detect that the client closed the connection. |
boolean |
completeLifecycle(AtmosphereResource r,
boolean cancelled)
Cancel or times out an AtmosphereResource by invoking it's associated AtmosphereHandler.onStateChange(AtmosphereResourceEvent) |
String |
getContainerName()
Return the container's name. |
void |
init(javax.servlet.ServletConfig sc)
Initialize the WebServer using the ServletConfig |
protected void |
invokeAtmosphereHandler(AtmosphereResourceImpl r)
Invoke the associated AtmosphereHandler. |
protected AtmosphereFramework.AtmosphereHandlerWrapper |
map(AtmosphereRequest req)
Return the AtmosphereHandler mapped to the passed servlet-path. |
Action |
resumed(AtmosphereRequest request,
AtmosphereResponse response)
All proprietary Comet based Servlet must invoke the resume method when the Atmosphere's application
decide to resume the AtmosphereResponse. |
protected void |
shutdown()
|
protected boolean |
supportSession()
Is HttpSession supported |
boolean |
supportWebSocket()
Return true if this implementation supports the websocket protocol. |
Action |
suspended(AtmosphereRequest request,
AtmosphereResponse response)
All proprietary Comet based Servlet must invoke the suspended method when the first request comes in. |
Action |
timedout(AtmosphereRequest req,
AtmosphereResponse res)
All proprietary Comet based Servlet must invoke the timedout method when the underlying WebServer time
out the AtmosphereResponse. |
protected boolean |
trackActiveRequest(AtmosphereRequest req)
|
| 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.AsyncSupport |
|---|
service |
| Field Detail |
|---|
protected static final Action timedoutAction
protected static final Action cancelledAction
protected final AtmosphereConfig config
protected final ConcurrentHashMap<AtmosphereRequest,AtmosphereResource> aliveRequests
| Constructor Detail |
|---|
public AsynchronousProcessor(AtmosphereConfig config)
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
AsyncSupportServletConfig
init in interface AsyncSupport<AtmosphereResourceImpl>sc - the ServletConfig
javax.servlet.ServletExceptionprotected boolean supportSession()
HttpSession supported
public String getContainerName()
getContainerName in interface AsyncSupport<AtmosphereResourceImpl>
public Action suspended(AtmosphereRequest request,
AtmosphereResponse response)
throws IOException,
javax.servlet.ServletException
Servlet must invoke the suspended method when the first request comes in.
The returned value, of type Action, tells the proprietary Comet Servlet to suspended or not the
current AtmosphereResponse.
request - the AtmosphereRequestresponse - the AtmosphereResponse
IOException
javax.servlet.ServletExceptionpublic void action(AtmosphereResourceImpl r)
AsyncSupportAction from an ActionEvent operation like suspend, resume or timed out.
action in interface AsyncSupport<AtmosphereResourceImpl>r - An instance of Action
protected AtmosphereFramework.AtmosphereHandlerWrapper map(AtmosphereRequest req)
throws javax.servlet.ServletException
AtmosphereHandler mapped to the passed servlet-path.
req - the AtmosphereResponse
AtmosphereHandler mapped to the passed servlet-path.
javax.servlet.ServletException
public Action resumed(AtmosphereRequest request,
AtmosphereResponse response)
throws IOException,
javax.servlet.ServletException
Servlet must invoke the resume method when the Atmosphere's application
decide to resume the AtmosphereResponse. The returned value, of type Action, tells the
proprietary Comet Servlet to resume (again), suspended or do nothing with the current AtmosphereResponse.
request - the AtmosphereRequestresponse - the AtmosphereResponse
IOException
javax.servlet.ServletException
public Action timedout(AtmosphereRequest req,
AtmosphereResponse res)
throws IOException,
javax.servlet.ServletException
Servlet must invoke the timedout method when the underlying WebServer time
out the AtmosphereResponse. The returned value, of type Action, tells the proprietary
Comet Servlet to resume (again), suspended or do nothing with the current AtmosphereResponse.
req - the AtmosphereRequestres - the AtmosphereResponse
IOException
javax.servlet.ServletExceptionprotected boolean trackActiveRequest(AtmosphereRequest req)
public boolean completeLifecycle(AtmosphereResource r,
boolean cancelled)
AtmosphereResource by invoking it's associated AtmosphereHandler.onStateChange(AtmosphereResourceEvent)
r - an AtmosphereResourcecancelled - true if cancelled, false if timedout
protected void invokeAtmosphereHandler(AtmosphereResourceImpl r)
throws IOException
AtmosphereHandler. This method must be synchronized on an AtmosphereResource.
r - a AtmosphereResourceImpl
IOException
public Action cancelled(AtmosphereRequest req,
AtmosphereResponse res)
throws IOException,
javax.servlet.ServletException
Servlet must invoke the cancelled method when the underlying WebServer
detect that the client closed the connection.
req - the AtmosphereRequestres - the AtmosphereResponse
IOException
javax.servlet.ServletExceptionprotected void shutdown()
public boolean supportWebSocket()
AsyncSupport
supportWebSocket in interface AsyncSupport<AtmosphereResourceImpl>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||