01: package com.ibm.webdav.protocol;
02:
03: /*
04: * (C) Copyright IBM Corp. 2000 All rights reserved.
05: *
06: * The program is provided "AS IS" without any warranty express or
07: * implied, including the warranty of non-infringement and the implied
08: * warranties of merchantibility and fitness for a particular purpose.
09: * IBM will not be liable for any damages suffered by you as a result
10: * of using the Program. In no event will IBM be liable for any
11: * special, indirect or consequential damages or lost profits even if
12: * IBM has been advised of the possibility of their occurrence. IBM
13: * will not be liable for any third party claims against you.
14: */
15:
16: /** A factory class for creating a URL stream handler for DAV4J.
17: * At present, http and rmi protocols are implemented.
18: *
19: */
20: public class URLStreamHandlerFactory implements
21: java.net.URLStreamHandlerFactory {
22: /**
23: * Construct a URLStreamHandlerFactory.
24: */
25: public URLStreamHandlerFactory() {
26: super ();
27: }
28:
29: /**
30: * Create a URL stream handler for WebDAV.
31: * At present, http and rmi protocols are implemented.
32: * If null is returned, then the JDK uses sun.net.www.protocol.<protocol>.Handler.
33: *
34: * @return java.net.URLStreamHandler: The URL stream handler for this protocol.
35: * @param name String: The protocol name, e.g. "http".
36: * @author Arthur Ryman
37: *
38: */
39: public java.net.URLStreamHandler createURLStreamHandler(
40: String protocol) {
41: if (protocol.equalsIgnoreCase("http")) {
42: return new com.ibm.webdav.protocol.http.Handler();
43: } else if (protocol.equalsIgnoreCase("rmi")) {
44: return new com.ibm.webdav.protocol.rmi.Handler();
45: }
46:
47: return null;
48: }
49: }
|