org.xlightweb
Interface IHttpConnection

Package class diagram package IHttpConnection
All Superinterfaces:
Closeable, IConnection
All Known Implementing Classes:
org.xlightweb.AbstractHttpConnection, HttpClientConnection, HttpServerConnection

public interface IHttpConnection
extends IConnection

A http connection (session) between two http client and http server.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.xsocket.connection.IConnection
IConnection.FlushMode
 
Field Summary
static int DEFAULT_CONNECT_TIMEOUT_MILLIS
           
static long DEFAULT_DATA_RESPONSE_TIMEOUT_MILLIS
           
static long DEFAULT_RESPONSE_TIMEOUT_MILLIS
           
 
Fields inherited from interface org.xsocket.connection.IConnection
DEFAULT_AUTOFLUSH, DEFAULT_CONNECTION_TIMEOUT_MILLIS, DEFAULT_FLUSH_MODE, DEFAULT_IDLE_TIMEOUT_MILLIS, INITIAL_DEFAULT_ENCODING, MAX_TIMEOUT_MILLIS, SO_KEEPALIVE, SO_LINGER, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
 
Method Summary
 void activateSecuredMode()
          ad hoc activation of a secured mode (SSL).
 void addConnectionHandler(IHttpConnectionHandler connectionHandler)
          adds a connection handler
 void closeQuitly()
          closes this connection by swallowing io exceptions
 void destroy()
          closes the connection in a unlean way
 long getBodyDataReceiveTimeoutMillis()
          returns body data receive timeout
 INonBlockingConnection getUnderlyingTcpConnection()
          returns the underlying tcp connection
 Executor getWorkerpool()
          return the worker pool which is used to process the call back methods
 boolean isPersistent()
          returns if the connection is persistent
 boolean isReceivingSuspended()
          returns true if receiving is suspended
 boolean isSecure()
          returns if the connection is in secured mode
 void removeConnectionHandler(IHttpConnectionHandler connectionHandler)
          removes a connectrion handler
 void resumeReceiving()
          resume receiving data from the underlying subsystem
 void setBodyDataReceiveTimeoutMillis(long bodyDataReceiveTimeoutMillis)
          set the body data receive timeout
 void setWriteTransferRate(int bytesPerSecond)
          set the send delay time.
 void suspendReceiving()
          suspend receiving data from the underlying subsystem
 
Methods inherited from interface org.xsocket.connection.IConnection
getAttachment, getConnectionTimeoutMillis, getId, getIdleTimeoutMillis, getLocalAddress, getLocalPort, getOption, getOptions, getRemainingMillisToConnectionTimeout, getRemainingMillisToIdleTimeout, getRemoteAddress, getRemotePort, isOpen, isServerSide, setAttachment, setConnectionTimeoutMillis, setIdleTimeoutMillis, setOption
 
Methods inherited from interface java.io.Closeable
close
 

Field Detail

DEFAULT_CONNECT_TIMEOUT_MILLIS

static final int DEFAULT_CONNECT_TIMEOUT_MILLIS
See Also:
Constant Field Values

DEFAULT_RESPONSE_TIMEOUT_MILLIS

static final long DEFAULT_RESPONSE_TIMEOUT_MILLIS
See Also:
Constant Field Values

DEFAULT_DATA_RESPONSE_TIMEOUT_MILLIS

static final long DEFAULT_DATA_RESPONSE_TIMEOUT_MILLIS
See Also:
Constant Field Values
Method Detail

isPersistent

boolean isPersistent()
returns if the connection is persistent

Returns:
true, if connection is persistent

activateSecuredMode

void activateSecuredMode()
                         throws IOException
ad hoc activation of a secured mode (SSL). By performing of this method all remaining data to send will be flushed. After this all data will be sent and received in the secured mode

Throws:
IOException - If some other I/O error occurs

isSecure

boolean isSecure()
returns if the connection is in secured mode

Returns:
true, if the connection is in secured mode

setWriteTransferRate

void setWriteTransferRate(int bytesPerSecond)
                          throws ClosedChannelException,
                                 IOException
set the send delay time. Data to write will be buffered internally and be written to the underlying subsystem based on the given write rate. The write methods will not block for this time.
By default the write transfer rate is set with UNLIMITED

Reduced write transfer is only supported for FlushMode.ASYNC. see INonBlockingConnection#setFlushmode(org.xsocket.connection.IConnection.FlushMode))

Parameters:
bytesPerSecond - the transfer rate of the outgoing data
Throws:
ClosedChannelException - If the underlying socket is already closed
IOException - If some other I/O error occurs

getWorkerpool

Executor getWorkerpool()
return the worker pool which is used to process the call back methods

Returns:
the worker pool

suspendReceiving

void suspendReceiving()
                      throws IOException
suspend receiving data from the underlying subsystem

Throws:
IOException - If some other I/O error occurs

isReceivingSuspended

boolean isReceivingSuspended()
returns true if receiving is suspended

Returns:
true, if receiving is suspended

resumeReceiving

void resumeReceiving()
                     throws IOException
resume receiving data from the underlying subsystem

Throws:
IOException - If some other I/O error occurs

getBodyDataReceiveTimeoutMillis

long getBodyDataReceiveTimeoutMillis()
returns body data receive timeout

Returns:
the body data receive timeout

setBodyDataReceiveTimeoutMillis

void setBodyDataReceiveTimeoutMillis(long bodyDataReceiveTimeoutMillis)
set the body data receive timeout

Parameters:
bodyDataReceiveTimeoutMillis - the timeout

addConnectionHandler

void addConnectionHandler(IHttpConnectionHandler connectionHandler)
adds a connection handler

Parameters:
connectionHandler - the connection handler

removeConnectionHandler

void removeConnectionHandler(IHttpConnectionHandler connectionHandler)
removes a connectrion handler

Parameters:
connectionHandler - the connection handler

getUnderlyingTcpConnection

INonBlockingConnection getUnderlyingTcpConnection()
returns the underlying tcp connection

Returns:
the underlying tcp connection

closeQuitly

void closeQuitly()
closes this connection by swallowing io exceptions


destroy

void destroy()
closes the connection in a unlean way