SK.gnome.dwarf.http
Class HTTPServer

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.GenericServer
          extended bySK.gnome.dwarf.thread.ThreadServer
              extended bySK.gnome.dwarf.thread.MultiThreadServer
                  extended bySK.gnome.dwarf.tcpip.TCPIPServer
                      extended bySK.gnome.dwarf.http.HTTPServer
All Implemented Interfaces:
SK.gnome.dwarf.Reportable, java.lang.Runnable, SK.gnome.dwarf.Server, SK.gnome.dwarf.Service

public class HTTPServer
extends SK.gnome.dwarf.tcpip.TCPIPServer

This is the main HTTP Server object.

This class provides a container for the HTTPHandler, SessionManager and Host objects. The first one processes the HTTP requests, the second one manages the HTTP sessions and the last one provides the virtual hosts.

An instance of the HTTPParameters class may be added to the HTTPServer in order to provide a custom set of runtime parameters.


Field Summary
protected  java.util.Map hosts
          Mapping between host identification strings and the Host objects.
protected  SessionManager sessionManager
          The session manager.
 
Fields inherited from class SK.gnome.dwarf.tcpip.TCPIPServer
sslContext
 
Fields inherited from class SK.gnome.dwarf.thread.MultiThreadServer
counter
 
Fields inherited from class SK.gnome.dwarf.thread.ThreadServer
daemon, thread
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
HTTPServer(java.lang.String name)
          Creates a new HTTPServer.
 
Method Summary
 void addService(SK.gnome.dwarf.Service service)
          Adds a service to the server.
 Host getHost(java.lang.String id)
          Returns the Host object by the given host identification.
protected  int getRequestReadTimeout()
           
 SessionManager getSessionManager()
          Returns the session manager.
 void init(SK.gnome.dwarf.Server parent)
          Initializes the server.
 
Methods inherited from class SK.gnome.dwarf.tcpip.TCPIPServer
createSSLServerSocket, createSSLServerSocket, createSSLSocket, enqueue, finish, getTCPRequest, isBlocking, isSSLConfigured, loop, report, setKeyPwd, setKeyStorePwd, setKeyStoreURL, setRegistrationQueueSize, setRequestClass, setSSLProtocol, shutdown, start
 
Methods inherited from class SK.gnome.dwarf.thread.MultiThreadServer
dequeue, enableThread, getHandlerTimeout, setHandlerClass, setHandlerTimeout, setMaxHandlers, setMinHandlers, setQueueSize, setSingleRequest, wakeUpHandlers
 
Methods inherited from class SK.gnome.dwarf.thread.ThreadServer
finish, run, setDaemon, stop
 
Methods inherited from class SK.gnome.dwarf.GenericServer
addService, getAuthenticator, getLogger, getParameters, getService, getServices, getServices, removeService
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getName, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface SK.gnome.dwarf.Service
getFullName, getName, getState, log, log, login, logout
 

Field Detail

hosts

protected java.util.Map hosts
Mapping between host identification strings and the Host objects. The identification string is either a hostname or an IP address. A single Host instance can be mapped by more then one string identification.


sessionManager

protected SessionManager sessionManager
The session manager.

Contains a reference to the SessionManager object. The value is set by the addService method if a service being added to the server implements this interface.

Constructor Detail

HTTPServer

public HTTPServer(java.lang.String name)
Creates a new HTTPServer.

The setHandlerClass(HTTPHandler.class) is invoked to set the desired handler class. That means the server will use HTTPHandler objects for handling the client connections by default.

Method Detail

addService

public void addService(SK.gnome.dwarf.Service service)
                throws SK.gnome.dwarf.ServiceException
Adds a service to the server.

If a service being added to the HTTPServer implements the SessionManager interface, it is also stored in the sessionManager field.

Throws:
SK.gnome.dwarf.ServiceException

init

public void init(SK.gnome.dwarf.Server parent)
          throws SK.gnome.dwarf.ServiceException
Initializes the server.

If the server contains no Host objects, a ServiceException is thrown to indicate the misconfiguration.

If the getParameters() method returns null, a new HTTPParameters instance is created and added to the server with the default parameter values.

Throws:
SK.gnome.dwarf.ServiceException

getHost

public Host getHost(java.lang.String id)
Returns the Host object by the given host identification.

The host identification can be either a hostname or an IP address. If no Host instance can be found for the given hostname/address, the null value is returned.

Parameters:
id - the host id
Returns:
the host instance or null

getSessionManager

public SessionManager getSessionManager()
Returns the session manager.

Returns the value of sessionManager field.

Returns:
the session manager

getRequestReadTimeout

protected int getRequestReadTimeout()


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.