public abstract class AsynchronousProcessor extends java.lang.Object implements AsyncSupport<AtmosphereResourceImpl>
| Modifier and Type | Class and Description |
|---|---|
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. |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ConcurrentHashMap<AtmosphereRequest,AtmosphereResource> |
aliveRequests |
protected static Action |
cancelledAction |
protected AtmosphereConfig |
config |
protected static Action |
timedoutAction |
| Constructor and Description |
|---|
AsynchronousProcessor(AtmosphereConfig config) |
| Modifier and Type | Method and Description |
|---|---|
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) |
java.lang.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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitserviceprotected static final Action timedoutAction
protected static final Action cancelledAction
protected final AtmosphereConfig config
protected final java.util.concurrent.ConcurrentHashMap<AtmosphereRequest,AtmosphereResource> aliveRequests
public AsynchronousProcessor(AtmosphereConfig config)
public void init(javax.servlet.ServletConfig sc)
throws javax.servlet.ServletException
AsyncSupportServletConfiginit in interface AsyncSupport<AtmosphereResourceImpl>sc - the ServletConfigjavax.servlet.ServletExceptionprotected boolean supportSession()
HttpSession supportedpublic java.lang.String getContainerName()
getContainerName in interface AsyncSupport<AtmosphereResourceImpl>public Action suspended(AtmosphereRequest request, AtmosphereResponse response) throws java.io.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 AtmosphereResponsejava.io.IOExceptionjavax.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 Actionprotected AtmosphereFramework.AtmosphereHandlerWrapper map(AtmosphereRequest req) throws javax.servlet.ServletException
AtmosphereHandler mapped to the passed servlet-path.req - the AtmosphereResponseAtmosphereHandler mapped to the passed servlet-path.javax.servlet.ServletExceptionpublic Action resumed(AtmosphereRequest request, AtmosphereResponse response) throws java.io.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 AtmosphereResponsejava.io.IOExceptionjavax.servlet.ServletExceptionpublic Action timedout(AtmosphereRequest req, AtmosphereResponse res) throws java.io.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 AtmosphereResponsejava.io.IOExceptionjavax.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 timedoutprotected void invokeAtmosphereHandler(AtmosphereResourceImpl r) throws java.io.IOException
AtmosphereHandler. This method must be synchronized on an AtmosphereResource.r - a AtmosphereResourceImpljava.io.IOExceptionpublic Action cancelled(AtmosphereRequest req, AtmosphereResponse res) throws java.io.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 AtmosphereResponsejava.io.IOExceptionjavax.servlet.ServletExceptionprotected void shutdown()
public boolean supportWebSocket()
AsyncSupportsupportWebSocket in interface AsyncSupport<AtmosphereResourceImpl>Copyright © 2018. All Rights Reserved.