com.caucho.server.http
Class AsyncContextImpl

java.lang.Object
  extended by com.caucho.server.http.AsyncContextImpl
All Implemented Interfaces:
SocketLinkCometListener, AsyncContext

public class AsyncContextImpl
extends java.lang.Object
implements AsyncContext, SocketLinkCometListener

Public API to control a comet connection.


Field Summary
 
Fields inherited from interface javax.servlet.AsyncContext
ASYNC_CONTEXT_PATH, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH
 
Constructor Summary
AsyncContextImpl(AbstractHttpRequest httpConn)
           
 
Method Summary
 void addListener(AsyncListener listener)
           
 void addListener(AsyncListener listener, ServletRequest request, ServletResponse response)
           
 void complete()
          Completes the comet connection
<T extends AsyncListener>
T
createListener(java.lang.Class<T> cl)
           
 void dispatch()
           
 void dispatch(ServletContext context, java.lang.String path)
           
 void dispatch(java.lang.String path)
           
 ServletRequest getRequest()
          Returns the originating request for the async.
 ServletResponse getResponse()
          Returns the originating request for the async.
 long getTimeout()
          Returns the suspend/idle timeout for the async request.
 boolean hasOriginalRequestAndResponse()
           
 void init(ServletRequest request, ServletResponse response, boolean isOriginal)
           
 boolean isAsyncComplete()
           
 boolean isAsyncStarted()
           
 void onComplete()
          Called when the connection closes
 void onError()
          CometHandler callback when the connection times out.
 void onStart(ServletRequest request, ServletResponse response)
          CometHandler callback when the connection starts.
 void onTimeout()
          CometHandler callback when the connection times out.
 void restart()
           
 void setTimeout(long idleTimeout)
          Sets the suspend/idle timeout for the async request.
 void start(java.lang.Runnable task)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsyncContextImpl

public AsyncContextImpl(AbstractHttpRequest httpConn)
Method Detail

restart

public void restart()

init

public void init(ServletRequest request,
                 ServletResponse response,
                 boolean isOriginal)

getRequest

public ServletRequest getRequest()
Returns the originating request for the async.

Specified by:
getRequest in interface AsyncContext

getResponse

public ServletResponse getResponse()
Returns the originating request for the async.

Specified by:
getResponse in interface AsyncContext

hasOriginalRequestAndResponse

public boolean hasOriginalRequestAndResponse()
Specified by:
hasOriginalRequestAndResponse in interface AsyncContext

setTimeout

public void setTimeout(long idleTimeout)
Sets the suspend/idle timeout for the async request.

Specified by:
setTimeout in interface AsyncContext

getTimeout

public long getTimeout()
Returns the suspend/idle timeout for the async request.

Specified by:
getTimeout in interface AsyncContext

isAsyncStarted

public boolean isAsyncStarted()

isAsyncComplete

public boolean isAsyncComplete()

addListener

public void addListener(AsyncListener listener)
Specified by:
addListener in interface AsyncContext

addListener

public void addListener(AsyncListener listener,
                        ServletRequest request,
                        ServletResponse response)
Specified by:
addListener in interface AsyncContext

createListener

public <T extends AsyncListener> T createListener(java.lang.Class<T> cl)
                                       throws ServletException
Specified by:
createListener in interface AsyncContext
Throws:
ServletException

dispatch

public void dispatch()
Specified by:
dispatch in interface AsyncContext

dispatch

public void dispatch(java.lang.String path)
Specified by:
dispatch in interface AsyncContext

dispatch

public void dispatch(ServletContext context,
                     java.lang.String path)
Specified by:
dispatch in interface AsyncContext

start

public void start(java.lang.Runnable task)
Specified by:
start in interface AsyncContext

complete

public void complete()
Completes the comet connection

Specified by:
complete in interface AsyncContext

onStart

public void onStart(ServletRequest request,
                    ServletResponse response)
CometHandler callback when the connection starts.


onTimeout

public void onTimeout()
CometHandler callback when the connection times out.

Specified by:
onTimeout in interface SocketLinkCometListener

onError

public void onError()
CometHandler callback when the connection times out.


onComplete

public void onComplete()
Description copied from interface: SocketLinkCometListener
Called when the connection closes

Specified by:
onComplete in interface SocketLinkCometListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object