com.caucho.server.connection
Class Connection

java.lang.Object
  extended by com.caucho.server.connection.Connection
Direct Known Subclasses:
StreamConnection, TcpConnection

public abstract class Connection
extends java.lang.Object

Represents a protocol-independent connection. Prococol servers and their associated Requests use Connection to retrieve the read and write streams and to get information about the connection.

TcpConnection is the most common implementation. The test harness provides a string based Connection.


Constructor Summary
Connection()
           
 
Method Summary
 void closeController(ConnectionCometController controller)
          Close the controller
abstract  int getId()
          Returns the connection id.
abstract  java.net.InetAddress getLocalAddress()
          Returns the local address of the connection
abstract  int getLocalPort()
          Returns the local port of the connection
 ReadStream getReadStream()
          Returns the connection's buffered read stream.
abstract  java.net.InetAddress getRemoteAddress()
          Returns the remote address of the connection
 int getRemoteAddress(byte[] buffer, int offset, int length)
          Returns the remote address of the connection
 java.lang.String getRemoteHost()
          Returns the remote client's inet address.
abstract  int getRemotePort()
          Returns the remove port of the connection
 java.lang.String getVirtualHost()
          Returns the static virtual host
 WriteStream getWriteStream()
          Returns the connection's buffered write stream.
 boolean isComet()
          Returns true for a comet connection
 boolean isDuplex()
          Returns true for a duplex connection
 boolean isSecure()
          Returns true if secure (ssl)
 boolean isSuspend()
          Returns true for a comet connection
 void sendBroadcast(BroadcastTask task)
          Sends a broadcast request.
 ConnectionCometController toComet(boolean isTop, ServletRequest request, ServletResponse response)
          Starts a comet request
protected  boolean wake()
          Wakes the connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection()
Method Detail

getId

public abstract int getId()
Returns the connection id. Primarily for debugging.


getReadStream

public final ReadStream getReadStream()
Returns the connection's buffered read stream. If the ReadStream needs to block, it will automatically flush the corresponding WriteStream.


getWriteStream

public final WriteStream getWriteStream()
Returns the connection's buffered write stream. If the ReadStream needs to block, it will automatically flush the corresponding WriteStream.


isSecure

public boolean isSecure()
Returns true if secure (ssl)


getVirtualHost

public java.lang.String getVirtualHost()
Returns the static virtual host


getLocalAddress

public abstract java.net.InetAddress getLocalAddress()
Returns the local address of the connection


getLocalPort

public abstract int getLocalPort()
Returns the local port of the connection


getRemoteAddress

public abstract java.net.InetAddress getRemoteAddress()
Returns the remote address of the connection


getRemoteHost

public java.lang.String getRemoteHost()
Returns the remote client's inet address.


getRemoteAddress

public int getRemoteAddress(byte[] buffer,
                            int offset,
                            int length)
Returns the remote address of the connection


getRemotePort

public abstract int getRemotePort()
Returns the remove port of the connection


sendBroadcast

public void sendBroadcast(BroadcastTask task)
Sends a broadcast request.


isComet

public boolean isComet()
Returns true for a comet connection


isSuspend

public boolean isSuspend()
Returns true for a comet connection


isDuplex

public boolean isDuplex()
Returns true for a duplex connection


toComet

public ConnectionCometController toComet(boolean isTop,
                                         ServletRequest request,
                                         ServletResponse response)
Starts a comet request


closeController

public void closeController(ConnectionCometController controller)
Close the controller


wake

protected boolean wake()
Wakes the connection