org.norther.tammi.spray.connector.chain
Class InterConnection

java.lang.Object
  extended by org.norther.tammi.core.pool.RecyclableSupport
      extended by org.norther.tammi.core.pool.PoolableSupport
          extended by org.norther.tammi.spray.connector.chain.AbstractConnection
              extended by org.norther.tammi.spray.connector.chain.InterConnection
All Implemented Interfaces:
Closeable, Serializable, Runnable, Poolable, Recyclable, Connection
Direct Known Subclasses:
ServletConnection

public class InterConnection
extends AbstractConnection

A connection through an internal call.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.norther.tammi.spray.connector.chain.Connection
BUSY, DONE, IDLE, IN_QUEUE, INITIAL
 
Constructor Summary
InterConnection(MBeanReference connector, MBeanReference filter, MBeanReference logger, MBeanReference timeout, Thread thread, ServletRequest req, ServletResponse res)
          Constructs a new connection.
 
Method Summary
 void dispose()
          Disposes the object by setting its disposed flag.
 int filter()
          Filters the request of this connection.
 int getByteCount()
          Gets the number of bytes written to this connection.
 Certificate[] getPeerCertificates()
          Gets the client certificate chain, if available.
 String getRemoteAddr()
          Gets the remote address of this connection.
 int getRemotePort()
          Gets the remote port of this connection.
 ServletRequest getRequest()
          Gets of the request of this connection.
 ServletResponse getResponse()
          Gets of the response of this connection.
 boolean isKeepConnection()
          Checks whether to keep this connection alive in idle after request processing.
 void recycle(MBeanReference connector, MBeanReference filter, MBeanReference logger, MBeanReference timeout, Thread thread, ServletRequest req, ServletResponse res)
          Recycles a connection.
 String toString()
           
 
Methods inherited from class org.norther.tammi.spray.connector.chain.AbstractConnection
close, connected, disposed, getConnectionStatus, getConnectionTime, getConnectionTimeout, getConnector, getFilter, getLogger, getMBeanServer, getReadyOps, getRequestTimeout, getTimeout, isContextThread, keepConnection, log, recycle, run, setReadyOps, waitUntilDone
 
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport
recycled
 
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport
isDisposed, recycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.pool.Recyclable
isDisposed, recycle
 

Constructor Detail

InterConnection

public InterConnection(MBeanReference connector,
                       MBeanReference filter,
                       MBeanReference logger,
                       MBeanReference timeout,
                       Thread thread,
                       ServletRequest req,
                       ServletResponse res)
Constructs a new connection.

Parameters:
connector - the connector.
filter - the active filter.
logger - the active logger.
timeout - the active timeout.
thread - the connector thread.
req - the servlet request.
res - the servlet response.
Method Detail

recycle

public void recycle(MBeanReference connector,
                    MBeanReference filter,
                    MBeanReference logger,
                    MBeanReference timeout,
                    Thread thread,
                    ServletRequest req,
                    ServletResponse res)
Recycles a connection.

Parameters:
connector - the connector.
filter - the active filter.
logger - the active logger.
timeout - the active timeout.
thread - the connector thread.
req - the servlet request.
res - the servlet response.

dispose

public void dispose()
Description copied from class: RecyclableSupport
Disposes the object by setting its disposed flag.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class AbstractConnection

isKeepConnection

public boolean isKeepConnection()
Description copied from interface: Connection
Checks whether to keep this connection alive in idle after request processing.

Specified by:
isKeepConnection in interface Connection
Overrides:
isKeepConnection in class AbstractConnection
Returns:
true to keep, false otherwise.

getByteCount

public int getByteCount()
Description copied from interface: Connection
Gets the number of bytes written to this connection.

Returns:
the number of bytes written.

getRemotePort

public int getRemotePort()
Description copied from interface: Connection
Gets the remote port of this connection.

Returns:
the remote port.

getRemoteAddr

public String getRemoteAddr()
Description copied from interface: Connection
Gets the remote address of this connection.

Returns:
the remote address.

getRequest

public ServletRequest getRequest()
Description copied from interface: Connection
Gets of the request of this connection.

Returns:
the request.

getResponse

public ServletResponse getResponse()
Description copied from interface: Connection
Gets of the response of this connection.

Returns:
the response.

getPeerCertificates

public Certificate[] getPeerCertificates()
Description copied from interface: Connection
Gets the client certificate chain, if available.

Returns:
an array of certificates or null.

filter

public int filter()
           throws ServletException,
                  IOException
Description copied from interface: Connection
Filters the request of this connection. It should return the number of available bytes in the connection for reprocessing or -1 to close the connection.

Returns:
the number of bytes to reprocess.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004 The Norther Organization. All rights reserved.