org.w3c.www.protocol.http
Class HttpIDMServer
java.lang.Object
|
+--org.w3c.www.protocol.http.HttpServer
|
+--org.w3c.www.protocol.http.HttpBasicServer
|
+--org.w3c.www.protocol.http.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 |
state |
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 |
getState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
debug
public static boolean debug
HttpIDMServer
HttpIDMServer()
- Empty constructor.
allocateConnection
protected org.w3c.www.protocol.http.HttpBasicConnection allocateConnection()
throws java.io.IOException
- 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.
- Overrides:
allocateConnection
in class org.w3c.www.protocol.http.HttpBasicServer
- Returns:
- A freshly allocated connection, inserted in the idle connection
list.
- Throws:
java.io.IOException
- If the server is unreachable through all of
Its IP addresses.
getConnection
protected org.w3c.www.protocol.http.HttpBasicConnection getConnection()
throws java.io.IOException
- Overrides:
getConnection
in class org.w3c.www.protocol.http.HttpBasicServer
java.io.IOException
getConnection
protected org.w3c.www.protocol.http.HttpBasicConnection getConnection(java.lang.String role)
throws java.io.IOException
java.io.IOException
allocateConnection
protected org.w3c.www.protocol.http.HttpBasicConnection allocateConnection(java.lang.String role)
throws java.io.IOException
java.io.IOException
runRequest
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.
- Overrides:
runRequest
in class org.w3c.www.protocol.http.HttpBasicServer
- Parameters:
request
- The request to run.
- Returns:
- A Reply instance, containing the reply headers, and the
optional reply entity, to be read by the calling thread.
- Throws:
HttpException
- If the request processing failed.
Copyright © 2003 DRIM Team. All Rights Reserved.