01: /**
02: * Copyright (c) 2000/2001 Thomas Kopp
03: * All rights reserved.
04: *
05: * Redistribution and use in source and binary forms, with or without
06: * modification, are permitted provided that the following conditions
07: * are met:
08: * 1. Redistributions of source code must retain the above copyright
09: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24: * SUCH DAMAGE.
25: */package org.w3c.jigsaw.https;
26:
27: import java.net.URL;
28:
29: import org.w3c.jigsaw.daemon.ServerHandlerInitException;
30: import org.w3c.jigsaw.http.httpd;
31:
32: import org.w3c.tools.resources.ReplyInterface;
33: import org.w3c.tools.resources.RequestInterface;
34: import org.w3c.tools.resources.ResourceException;
35: import org.w3c.tools.resources.ProtocolException;
36:
37: /**
38: * @author Thomas Kopp, Dialogika GmbH
39: * @version 1.0.2, 30 January 2001
40: *
41: * This class extends a Jigsaw httpd daemon
42: * in order to supply a Jigsaw httpd daemon with https support
43: * in accordance with the JSSE API.
44: */
45: public class httpsd extends httpd {
46:
47: /**
48: * reference to the TLS support adapter of this daemon
49: */
50: private SSLAdapter adapter = null;
51:
52: /**
53: * constructor of this daemon
54: */
55: public httpsd() {
56: super ();
57: adapter = new SSLAdapter(this );
58: }
59:
60: /**
61: * clone method of this daemon
62: */
63: protected Object clone() throws CloneNotSupportedException {
64: httpsd daemon = (httpsd) (super .clone());
65: daemon.adapter = new SSLAdapter(daemon);
66: return daemon;
67: }
68:
69: /**
70: * method for initializing the properties of this daemon
71: * @exception ServerHandlerInitException if initialization fails
72: */
73: protected void initializeProperties()
74: throws ServerHandlerInitException {
75: super .initializeProperties();
76: adapter.initializeProperties();
77: }
78:
79: /**
80: * method for supplying a reply interface of a request
81: * @param req current request to be handled
82: * @return reply for a current request
83: */
84: public ReplyInterface perform(RequestInterface req)
85: throws ProtocolException, ResourceException {
86: adapter.perform(req);
87: return super .perform(req);
88: }
89:
90: /**
91: * method for supplying the uri of this daemon
92: * @return uri of this daemon
93: */
94: public URL getURL() {
95: return adapter.getURL();
96: }
97: }
|