Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / jigsaw / https / httpsd.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigsaw/https/httpsd.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/jigsaw/https/httpsd.java
new file mode 100644 (file)
index 0000000..2209d4e
--- /dev/null
@@ -0,0 +1,103 @@
+/**\r
+ * Copyright (c) 2000/2001 Thomas Kopp\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ */\r
+// $Id: httpsd.java,v 1.1 2010/06/15 12:29:03 smhuang Exp $\r
+package org.w3c.jigsaw.https;\r
+\r
+import java.net.URL;\r
+\r
+import org.w3c.jigsaw.daemon.ServerHandlerInitException;\r
+import org.w3c.jigsaw.http.httpd;\r
+\r
+import org.w3c.tools.resources.ReplyInterface;\r
+import org.w3c.tools.resources.RequestInterface;\r
+import org.w3c.tools.resources.ResourceException;\r
+import org.w3c.tools.resources.ProtocolException;\r
+\r
+/**\r
+ * @author Thomas Kopp, Dialogika GmbH\r
+ * @version 1.0.2, 30 January 2001\r
+ * \r
+ * This class extends a Jigsaw httpd daemon\r
+ * in order to supply a Jigsaw httpd daemon with https support\r
+ * in accordance with the JSSE API.\r
+ */\r
+public class httpsd extends httpd {\r
+\r
+    /**\r
+     * reference to the TLS support adapter of this daemon\r
+     */\r
+    private SSLAdapter adapter = null;\r
+    \r
+    /**\r
+     * constructor of this daemon\r
+     */\r
+    public httpsd() {\r
+        super();\r
+        adapter = new SSLAdapter(this);\r
+    }\r
+    \r
+    /**\r
+     * clone method of this daemon\r
+     */\r
+    protected Object clone()\r
+        throws CloneNotSupportedException \r
+    {\r
+        httpsd daemon = (httpsd)(super.clone());\r
+        daemon.adapter = new SSLAdapter(daemon);\r
+        return daemon;\r
+    }\r
+    \r
+    /**\r
+     * method for initializing the properties of this daemon\r
+     * @exception ServerHandlerInitException if initialization fails\r
+     */\r
+    protected void initializeProperties() \r
+        throws ServerHandlerInitException \r
+    {\r
+       super.initializeProperties();\r
+        adapter.initializeProperties();\r
+    }\r
+\r
+    /**\r
+     * method for supplying a reply interface of a request\r
+     * @param req current request to be handled\r
+     * @return reply for a current request\r
+     */\r
+    public ReplyInterface perform(RequestInterface req) \r
+       throws ProtocolException, ResourceException  \r
+    {\r
+        adapter.perform(req);\r
+       return super.perform(req);\r
+    }\r
+    \r
+    /**\r
+     * method for supplying the uri of this daemon\r
+     * @return uri of this daemon\r
+     */\r
+    public URL getURL() {\r
+        return adapter.getURL();\r
+    }\r
+}\r