--- /dev/null
+// HttpServer.java\r
+// $Id: HttpServer.java,v 1.1 2010/06/15 12:25:16 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.www.protocol.http;\r
+\r
+/**\r
+ * The HttpServer interface.\r
+ * This interface is used to control the communication between the HttpManager\r
+ * and the HttpServer on one side, and between the HttpServer and the\r
+ * HttpConnection on the other side.\r
+ * <p>The implementation of the Connection part of the interface is optional\r
+ * and should be provided only if your server instance uses the connection\r
+ * concept.\r
+ */\r
+\r
+public abstract class HttpServer {\r
+ protected HttpServerState state = null;\r
+\r
+ /**\r
+ * Get this servers' protocol.\r
+ * @return A String encoding the protocol used to dialog with the target\r
+ * server.\r
+ */\r
+\r
+ abstract public String getProtocol();\r
+\r
+ /**\r
+ * Get the manager's state for that server.\r
+ * @return The manager state.\r
+ */\r
+\r
+ protected final HttpServerState getState() {\r
+ return state;\r
+ }\r
+\r
+ /**\r
+ * Get this server's major version number.\r
+ * @return The server's major number version, or <strong>-1</strong>\r
+ * if still unknown.\r
+ */\r
+\r
+ abstract public short getMajorVersion();\r
+\r
+ /**\r
+ * Get this server's minor version number.\r
+ * @return The server's minor number version, or <strong>-1</strong>\r
+ * if still unknown.\r
+ */\r
+\r
+ abstract public short getMinorVersion();\r
+\r
+ /**\r
+ * HTTP manager interface - Handle this request in sync mode.\r
+ * @param request The request this server should run.\r
+ * @return A Reply instance, containing the target server's reply.\r
+ * @exception HttpException If anything failed during request processing.\r
+ */\r
+\r
+ abstract public Reply runRequest(Request request) \r
+ throws HttpException;\r
+\r
+ /**\r
+ * Interrupt the given request (that was launched by that server).\r
+ * @param request The request to interrupt.\r
+ */\r
+\r
+ abstract protected void interruptRequest(Request request);\r
+\r
+ /**\r
+ * Set the new timeout for this server\r
+ * @param timeout The timeout value in milliseconds\r
+ */\r
+\r
+ abstract protected void setTimeout(int timeout);\r
+\r
+ /**\r
+ * Set the new connection timeout for this server\r
+ * @param timeout The timeout value in milliseconds\r
+ */\r
+\r
+ abstract protected void setConnTimeout(int conn_timeout);\r
+\r
+ /**\r
+ * Initialize this server instance for the given target location.\r
+ * @param manager The central HTTP protocol manager.\r
+ * @param state The manager's state for that server.\r
+ * @param host The target server's FQDN.\r
+ * @param port The target server's port number.\r
+ * @param timeout The timeout in millisecond for the sockets\r
+ * @exception HttpException If host coulnd't be resolved.\r
+ */\r
+\r
+ abstract public void initialize(HttpManager manager\r
+ , HttpServerState state\r
+ , String host\r
+ , int port\r
+ , int timeout) \r
+ throws HttpException;\r
+\r
+ /**\r
+ * Initialize this server instance for the given target location.\r
+ * @param manager The central HTTP protocol manager.\r
+ * @param state The manager's state for that server.\r
+ * @param host The target server's FQDN.\r
+ * @param port The target server's port number.\r
+ * @param timeout The timeout in millisecond for the sockets\r
+ * @param timeout The connection timeout in millisecond for the sockets\r
+ * @exception HttpException If host coulnd't be resolved.\r
+ */\r
+\r
+ abstract public void initialize(HttpManager manager\r
+ , HttpServerState state\r
+ , String host\r
+ , int port\r
+ , int timeout\r
+ , int connect_timeout) \r
+ throws HttpException;\r
+}\r