com.caucho.network.listen
Interface ProtocolConnection

All Known Implementing Classes:
AbstractHttpRequest, AbstractProtocolConnection, CompileRequest, FastCgiRequest, HmtpRequest, HmuxRequest, HttpRequest, MemcachedConnection, SnmpRequest, SocketPolicyRequest, StompConnection, StubSessionContextRequest, XmppRequest

public interface ProtocolConnection

Protocol specific information for each connection. ProtocolConnection is reused to reduce memory allocations.

ProtocolConnections are created by Protocol.createConnection


Method Summary
 java.lang.String getProtocolRequestURL()
          Returns a request URL for debugging/management.
 boolean handleRequest()
          Handles a new request.
 boolean handleResume()
          Handles a resumption of the connection for an async/comet request.
 void init()
          Initialize the connection.
 boolean isWaitForRead()
          Return true if the connection should wait for a read before handling the request.
 void onCloseConnection()
          Handles a close event when the connection is closed.
 void onStartConnection()
          Called when the connection starts, i.e.
 

Method Detail

init

void init()
Initialize the connection. At this point, the current thread is the connection thread.


isWaitForRead

boolean isWaitForRead()
Return true if the connection should wait for a read before handling the request.


onStartConnection

void onStartConnection()
Called when the connection starts, i.e. just after the accept


handleRequest

boolean handleRequest()
                      throws java.io.IOException
Handles a new request. The controlling TcpServer may call handleRequest again after the connection completes, so the implementation must initialize any variables for each connection.

Throws:
java.io.IOException

getProtocolRequestURL

java.lang.String getProtocolRequestURL()
Returns a request URL for debugging/management.


handleResume

boolean handleResume()
                     throws java.io.IOException
Handles a resumption of the connection for an async/comet request.

Throws:
java.io.IOException

onCloseConnection

void onCloseConnection()
Handles a close event when the connection is closed.