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.


Field Summary
protected  ConnectionController _controller
           
 
Constructor Summary
Connection()
           
 
Method Summary
protected  void closeControllerImpl()
           
 ConnectionController getController()
          Connection 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 isSecure()
          Returns true if secure (ssl)
 void sendBroadcast(BroadcastTask task)
          Sends a broadcast request.
protected  void setController(ConnectionController controller)
          Connection controller.
protected  boolean wake()
          Wake the controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_controller

protected ConnectionController _controller
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.


setController

protected void setController(ConnectionController controller)
Connection controller.


getController

public ConnectionController getController()
Connection controller.


wake

protected boolean wake()
Wake the controller.


closeControllerImpl

protected void closeControllerImpl()