org.abstracthorizon.danube.http
Class HTTPServerConnectionHandler

java.lang.Object
  extended by org.abstracthorizon.danube.service.server.ServerConnectionHandler
      extended by org.abstracthorizon.danube.http.HTTPServerConnectionHandler
All Implemented Interfaces:
ConnectionHandler

public class HTTPServerConnectionHandler
extends ServerConnectionHandler

This class is entry point for HTTP server. It extends Selector class adding "Server" header and handles HTTP/1.1 "Connection: keep-alive" (multiple requests over singe socket connection.

Author:
Daniel Sendula

Field Summary
static SimpleDateFormat DATE_FORMAT
          RFC822 date format
static int DEFAULT_BUFFER_SIZE
          Default buffer size of 8Kb
protected  int defaultBufferSize
          Default buffer size
protected  ConnectionHandler errorHandler
          Error handler
static String FULL_VERSION_STRING
          Full version string
static String VERSION_STRING
          Version string
 
Fields inherited from class org.abstracthorizon.danube.service.server.ServerConnectionHandler
connectionHandler, logger
 
Constructor Summary
HTTPServerConnectionHandler()
          Constructor
 
Method Summary
protected  Connection decorateConnection(Connection connection)
          This method can "decorate" connection wrapping it with own.
protected  void finishConnection(Connection connnection)
           
 int getDefaultBufferSize()
          Returns default buffer size
 ConnectionHandler getErrorHandler()
          Returns generic error handler
protected  boolean postProcessing(Connection connection, boolean persistConnection)
           
protected  void processConnection(Connection connection)
          Processes connection
 void setDefaultBufferSize(int defaultBufferSize)
          Sets default buffer size
 void setErrorHandler(ConnectionHandler errorHandler)
          Sets generic error handler
 
Methods inherited from class org.abstracthorizon.danube.service.server.ServerConnectionHandler
closeConnection, finishProcessingConnection, getConnectionHandler, handleConnection, postProcessing, setConnectionHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_STRING

public static final String VERSION_STRING
Version string

See Also:
Constant Field Values

FULL_VERSION_STRING

public static final String FULL_VERSION_STRING
Full version string

See Also:
Constant Field Values

DATE_FORMAT

public static final SimpleDateFormat DATE_FORMAT
RFC822 date format


DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Default buffer size of 8Kb

See Also:
Constant Field Values

errorHandler

protected ConnectionHandler errorHandler
Error handler


defaultBufferSize

protected int defaultBufferSize
Default buffer size

Constructor Detail

HTTPServerConnectionHandler

public HTTPServerConnectionHandler()
Constructor

Method Detail

getErrorHandler

public ConnectionHandler getErrorHandler()
Returns generic error handler

Returns:
generic error handler

setErrorHandler

public void setErrorHandler(ConnectionHandler errorHandler)
Sets generic error handler

Parameters:
errorHandler - generic error handler

getDefaultBufferSize

public int getDefaultBufferSize()
Returns default buffer size

Returns:
default buffer size

setDefaultBufferSize

public void setDefaultBufferSize(int defaultBufferSize)
Sets default buffer size

Parameters:
defaultBufferSize - default buffer size

processConnection

protected void processConnection(Connection connection)
Processes connection

Overrides:
processConnection in class ServerConnectionHandler
Parameters:
httpConnection - http connection to be processed
Throws:
IOException

decorateConnection

protected Connection decorateConnection(Connection connection)
Description copied from class: ServerConnectionHandler
This method can "decorate" connection wrapping it with own. This implementation does nothing

Overrides:
decorateConnection in class ServerConnectionHandler
Parameters:
connection - original conneciton
Returns:
decorated connection

postProcessing

protected boolean postProcessing(Connection connection,
                                 boolean persistConnection)

finishConnection

protected void finishConnection(Connection connnection)


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.