org.xlightweb.server
Class HttpServerConnection

Package class diagram package HttpServerConnection
java.lang.Object
  extended by org.xlightweb.AbstractHttpConnection
      extended by org.xlightweb.server.HttpServerConnection
All Implemented Interfaces:
Closeable, IHttpConnection, IConnection, IDestroyable

public final class HttpServerConnection
extends org.xlightweb.AbstractHttpConnection

Represents the server side endpoint implementation of a http connection. Typically, a HttpServerConnection will be created by the HttpProtocolAdapter which is used internally by the HttpServer.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xlightweb.AbstractHttpConnection
org.xlightweb.AbstractHttpConnection.AbstractExchange, org.xlightweb.AbstractHttpConnection.IMessageHandler, org.xlightweb.AbstractHttpConnection.IMessageHeaderHandler, org.xlightweb.AbstractHttpConnection.IMultimodeExecutor, org.xlightweb.AbstractHttpConnection.RequestHandlerAdapter, org.xlightweb.AbstractHttpConnection.ResponseHandlerAdapter
 
Nested classes/interfaces inherited from interface org.xsocket.connection.IConnection
IConnection.FlushMode
 
Field Summary
static boolean DEFAULT_AUTOHANDLE_CONNECTION_UPGRADE_HEADER
           
static Integer DEFAULT_RECEIVE_TIMEOUT_MILLIS
           
static boolean DEFAULT_REMOVE_REQUEST_CONNECTION_HEADER
           
static boolean DEFAULT_SESSION_MANAGEMENT
           
 
Fields inherited from interface org.xlightweb.IHttpConnection
DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_DATA_RESPONSE_TIMEOUT_MILLIS, 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
protected  org.xlightweb.AbstractHttpConnection.IMessageHeaderHandler getMessageHeaderHandler()
          
protected static int getSizeDataReceived(NonBlockingBodyDataSource body)
           
protected static int getSizeWritten(BodyDataSink body)
           
 boolean isServerSide()
          
protected  void onDisconnect()
           
protected  void onMessageWritten()
           
protected  void onProtocolException(Exception ex)
          
protected static void schedule(TimerTask task, long delay, long period)
          schedules the task
 void setMaxTransactions(int maxTransactions)
          set the max transactions per connection.
 void setRequestBodyDefaultEncoding(String defaultEncoding)
          set the request body default encoding.
 void setRequestTimeoutMillis(long requestTimeoutMillis)
          set the max receive timeout which is accepted for the connection.
 
Methods inherited from class org.xlightweb.AbstractHttpConnection
activateSecuredMode, addConnectionHandler, availableSilence, close, closeQuitly, destroy, destroy, destroy, destroy, forward, forwardBody, generateErrorMessageHtml, getAttachment, getBodyDataReceiveTimeoutMillis, getConnectionTimeoutMillis, getCountMessagesReceived, getCountMessagesSent, getCountReceivedBytes, getDataHandlerSilence, getDataReceived, getDataSourceOfInMemoryBodyDataSink, getExecutor, getId, getIdleTimeoutMillis, getLastTimeDataReceivedMillis, getLastTimeHeaderReceivedMillis, getLastTimeMessageTailReceivedMillis, getLastTimeWritten, getLocalAddress, getLocalPort, getMaxWriteBufferSize, getNumOpenTransactions, getOption, getOptions, getReceviedHeader, getRemainingMillisToConnectionTimeout, getRemainingMillisToIdleTimeout, getRemoteAddress, getRemotePort, getUnderlyingTcpConnection, getWorkerpool, incCountMessageReceived, incCountMessageSent, init, isAcceptingChunkedResponseBody, isAutoUncompress, isComplete, isContentTypeSupportsCharset, isEmpty, isForwardable, isNetworkendpoint, isOpen, isPersistent, isReceivingSuspended, isReuseable, isSecure, isSupports100Contine, newDetailedClosedChannelException, newDoNothingResponseHandler, newEmtpyBodyDataSink, newFormEncodedRequestWrapper, newInMemoryBodyDataSink, newMultimodeExecutor, onConnect, onConnectionTimeout, onIdleTimeout, onMessageCompleteReceived, parseEncoding, readByteBufferByLengthSilence, removeConnectionHandler, resumeReceiving, schedule, setAttachment, setAutocompressThreshold, setAutoUncompress, setBodyCloseListener, setBodyDataReceiveTimeoutMillis, setBodyDefaultEncoding, setConnectionTimeoutMillis, setDataHandlerSilence, setIdleTimeoutMillis, setLastTimeDataReceivedMillis, setLastTimeHeaderReceivedMillis, setLastTimeMessageTailReceivedMillis, setNetworkBodyDataSinkIgnoreWriteError, setOption, setPersistent, setWorkerpool, setWriteTransferRate, suspendReceiving, toString, writeMessage, writeMessage, writeMessage, writeMessageSilence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_REMOVE_REQUEST_CONNECTION_HEADER

public static final boolean DEFAULT_REMOVE_REQUEST_CONNECTION_HEADER
See Also:
Constant Field Values

DEFAULT_RECEIVE_TIMEOUT_MILLIS

public static final Integer DEFAULT_RECEIVE_TIMEOUT_MILLIS

DEFAULT_AUTOHANDLE_CONNECTION_UPGRADE_HEADER

public static final boolean DEFAULT_AUTOHANDLE_CONNECTION_UPGRADE_HEADER
See Also:
Constant Field Values

DEFAULT_SESSION_MANAGEMENT

public static final boolean DEFAULT_SESSION_MANAGEMENT
See Also:
Constant Field Values
Method Detail

isServerSide

public boolean isServerSide()


setMaxTransactions

public void setMaxTransactions(int maxTransactions)
set the max transactions per connection. Setting this filed causes that a keep-alive response header will be added

Parameters:
maxTransactions - the max transactions

setRequestBodyDefaultEncoding

public void setRequestBodyDefaultEncoding(String defaultEncoding)
set the request body default encoding. According to RFC 2616 the initial value is ISO-8859-1

Parameters:
encoding - the defaultEncoding

schedule

protected static void schedule(TimerTask task,
                               long delay,
                               long period)
schedules the task

Parameters:
task - the task to schedule
delay - the delay
period - the period

getSizeDataReceived

protected static int getSizeDataReceived(NonBlockingBodyDataSource body)

getSizeWritten

protected static int getSizeWritten(BodyDataSink body)

setRequestTimeoutMillis

public void setRequestTimeoutMillis(long requestTimeoutMillis)
set the max receive timeout which is accepted for the connection. Setting this field cases, that a keep-alive response header will be added

Parameters:
requestTimout - the timeout

onProtocolException

protected void onProtocolException(Exception ex)

Overrides:
onProtocolException in class org.xlightweb.AbstractHttpConnection

onMessageWritten

protected void onMessageWritten()
Overrides:
onMessageWritten in class org.xlightweb.AbstractHttpConnection

getMessageHeaderHandler

protected org.xlightweb.AbstractHttpConnection.IMessageHeaderHandler getMessageHeaderHandler()

Specified by:
getMessageHeaderHandler in class org.xlightweb.AbstractHttpConnection

onDisconnect

protected void onDisconnect()
Overrides:
onDisconnect in class org.xlightweb.AbstractHttpConnection