com.caucho.server.http
Class ConnectionCometController

java.lang.Object
  extended by com.caucho.server.http.ConnectionCometController
All Implemented Interfaces:
SocketLinkCometListener, CometController
Direct Known Subclasses:
AsyncConnectionImpl

public class ConnectionCometController
extends java.lang.Object
implements CometController, SocketLinkCometListener

Public API to control a comet connection.


Constructor Summary
ConnectionCometController(SocketLink conn, boolean isTop, ServletRequest request, ServletResponse response)
           
 
Method Summary
 void addAsyncListener(AsyncListener listener, ServletRequest request, ServletResponse response)
           
 void addListener(AsyncListener listener)
           
 void addListener(AsyncListener listener, ServletRequest request, ServletResponse response)
           
 void close()
          Closes the connection.
 void closeImpl()
           
 void complete()
          Complete the 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)
           
 java.lang.Object getAttribute(java.lang.String name)
          Gets a request attribute.
 java.lang.String getForwardPath()
           
 long getMaxIdleTime()
          Gets the max idle time.
 ServletRequest getRequest()
           
 ServletResponse getResponse()
           
 long getTimeout()
           
 boolean hasOriginalRequestAndResponse()
           
 boolean isActive()
          Returns true if the connection is active.
 boolean isClosed()
          Returns true if the connection is active.
 boolean isComet()
          Returns true for an active comet connection.
 boolean isComplete()
          Returns true if the connection is complete.
 boolean isDuplex()
          Returns true for a duplex controller
 boolean isTimeout()
          Return true if timed out
 void onComplete()
          Called when the connection closes
 void onTimeout()
          Called when the connection times out
 void removeAttribute(java.lang.String name)
          Remove a request attribute.
 void setAsyncListenerNode(AsyncListenerNode node)
          Sets the async listener
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets a request attribute.
 void setMaxIdleTime(long idleTime)
          Sets the max idle time.
 void setTimeout(long timeout)
           
 void start(java.lang.Runnable task)
           
 void startResume()
          Suspend the connection on the next request
 void timeout()
          Sets the timeout.
 java.lang.String toString()
           
 boolean wake()
          Wakes the connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionCometController

public ConnectionCometController(SocketLink conn,
                                 boolean isTop,
                                 ServletRequest request,
                                 ServletResponse response)
Method Detail

setMaxIdleTime

public void setMaxIdleTime(long idleTime)
Sets the max idle time.

Specified by:
setMaxIdleTime in interface CometController

getMaxIdleTime

public long getMaxIdleTime()
Gets the max idle time.

Specified by:
getMaxIdleTime in interface CometController

isComplete

public final boolean isComplete()
Returns true if the connection is complete.


complete

public final void complete()
Complete the connection


onTimeout

public void onTimeout()
Description copied from interface: SocketLinkCometListener
Called when the connection times out

Specified by:
onTimeout in interface SocketLinkCometListener

onComplete

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

Specified by:
onComplete in interface SocketLinkCometListener

startResume

public final void startResume()
Suspend the connection on the next request


wake

public final boolean wake()
Wakes the connection.

Specified by:
wake in interface CometController

isDuplex

public boolean isDuplex()
Returns true for a duplex controller


timeout

public final void timeout()
Sets the timeout.


isTimeout

public final boolean isTimeout()
Return true if timed out


isActive

public final boolean isActive()
Returns true if the connection is active.


isComet

public boolean isComet()
Returns true for an active comet connection.


setAsyncListenerNode

public void setAsyncListenerNode(AsyncListenerNode node)
Sets the async listener


addAsyncListener

public void addAsyncListener(AsyncListener listener,
                             ServletRequest request,
                             ServletResponse response)

addListener

public void addListener(AsyncListener listener)

addListener

public void addListener(AsyncListener listener,
                        ServletRequest request,
                        ServletResponse response)

createListener

public <T extends AsyncListener> T createListener(java.lang.Class<T> cl)
                                       throws ServletException
Throws:
ServletException

setTimeout

public void setTimeout(long timeout)

getTimeout

public long getTimeout()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Gets a request attribute.

Specified by:
getAttribute in interface CometController

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets a request attribute.

Specified by:
setAttribute in interface CometController

removeAttribute

public void removeAttribute(java.lang.String name)
Remove a request attribute.

Specified by:
removeAttribute in interface CometController

isClosed

public final boolean isClosed()
Returns true if the connection is active.

Specified by:
isClosed in interface CometController

getRequest

public ServletRequest getRequest()

getResponse

public ServletResponse getResponse()

hasOriginalRequestAndResponse

public boolean hasOriginalRequestAndResponse()

getForwardPath

public java.lang.String getForwardPath()

dispatch

public void dispatch()

dispatch

public void dispatch(java.lang.String path)

dispatch

public void dispatch(ServletContext context,
                     java.lang.String path)

start

public void start(java.lang.Runnable task)

close

public void close()
Closes the connection.

Specified by:
close in interface CometController

closeImpl

public void closeImpl()

toString

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