Class HttpIDMServer


public class HttpIDMServer
extends org.w3c.www.protocol.http.HttpBasicServer

The server class, to run requests. A server instance (ie an object conforming to the HttpServer interface is resposnsible for running all requests to a given host.

To do so, it manages a connnnection pool (ie a set of available connections) which it negotiates with the global HTTP manager. It keeps track of the connections it creates in order to serialize requests to the target server (when possible). In order to avoid deadlock due to implicit ordering of requests, a server that manages persistent (ie > 1.0) connections will always be able to open at least two connections to the same target.

Connections are kept track of by the server instance, which maintains at all point in time a list of idle connections. The way this is done may seem quite tricky, but beleive me, it's the best way I have found to handle it (there is here a typical deadlock situation - the same which is found in org.w3c.jigsaw.http.Client - due to the fact that the server instances need to be locked in order to change the connection pool, and at the same time each connection of the pool might have to notify the pool of some events. This can easily produce a deadlock...This situation is avoided here, by having the server locked only when appropriate...

The first HttpIDMServer initializes the identity management object. This is static to this class, so all objects have access to it, and all connections can be registered with the identity manager.

Field Summary
static boolean debug
Fields inherited from class org.w3c.www.protocol.http.HttpBasicServer
addrptr, addrs, connid, contacted, host, keepalive, lookupLimit, major, manager, minor, port, RQ_HTTP10, RQ_HTTP10_KA, RQ_HTTP11, RQ_HTTP11_TS, RQ_UNKNOWN, timeout
Fields inherited from class org.w3c.www.protocol.http.HttpServer
Constructor Summary
(package private) HttpIDMServer()
          Empty constructor.
Method Summary
protected  org.w3c.www.protocol.http.HttpBasicConnection allocateConnection()
          Connections management - Allocate a new connection for this server.
protected  org.w3c.www.protocol.http.HttpBasicConnection allocateConnection(java.lang.String role)
protected  org.w3c.www.protocol.http.HttpBasicConnection getConnection()
protected  org.w3c.www.protocol.http.HttpBasicConnection getConnection(java.lang.String role)
 org.w3c.www.protocol.http.Reply runRequest(org.w3c.www.protocol.http.Request request)
          Run the given request in synchronous mode.
Methods inherited from class org.w3c.www.protocol.http.HttpBasicServer
deleteConnection, doRequest, getMajorVersion, getMinorVersion, getProtocol, getRequestMode, http_unknown, http10_ka_run, http10_run, http11_run, http11_ts_run, initialize, interruptRequest, isTwoStage_10, isTwoStage_11, notifyObserver, notifyObserver, registerConnection, setHostAddr, setTimeout, toString, unregisterConnection, updateHostAddr, updateServerInfo
Methods inherited from class org.w3c.www.protocol.http.HttpServer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public static boolean debug
Constructor Detail


Empty constructor.

Method Detail


protected org.w3c.www.protocol.http.HttpBasicConnection allocateConnection()
Connections management - Allocate a new connection for this server. The connection is bound to the next available IP address, so that we are able to round-robin on them. If one of the DNS advertized IP address fails, we just try the next one, until one of them succeed or all of them fail.

If this method has to create a new connection, a HttpIDMConnection is created.

allocateConnection in class org.w3c.www.protocol.http.HttpBasicServer
A freshly allocated connection, inserted in the idle connection list.
Throws: - If the server is unreachable through all of Its IP addresses.


protected org.w3c.www.protocol.http.HttpBasicConnection getConnection()
getConnection in class org.w3c.www.protocol.http.HttpBasicServer


protected org.w3c.www.protocol.http.HttpBasicConnection getConnection(java.lang.String role)


protected org.w3c.www.protocol.http.HttpBasicConnection allocateConnection(java.lang.String role)


public org.w3c.www.protocol.http.Reply runRequest(org.w3c.www.protocol.http.Request request)
                                           throws org.w3c.www.protocol.http.HttpException
Run the given request in synchronous mode.

This method is taken from HttpbasicConnection. It differs only for the fact, that it always marks connections as idle, if they are not explicitely detected as keep-alive connections.

runRequest in class org.w3c.www.protocol.http.HttpBasicServer
request - The request to run.
A Reply instance, containing the reply headers, and the optional reply entity, to be read by the calling thread.
HttpException - If the request processing failed.

Copyright © 2003 DRIM Team. All Rights Reserved.