KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > webdav > protocol > URLStreamHandlerFactory


1 package com.ibm.webdav.protocol;
2
3 /*
4  * (C) Copyright IBM Corp. 2000 All rights reserved.
5  *
6  * The program is provided "AS IS" without any warranty express or
7  * implied, including the warranty of non-infringement and the implied
8  * warranties of merchantibility and fitness for a particular purpose.
9  * 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 java.net.URLStreamHandlerFactory JavaDoc {
21 /**
22  * Construct a URLStreamHandlerFactory.
23  */

24 public URLStreamHandlerFactory() {
25     super();
26 }
27 /**
28  * Create a URL stream handler for WebDAV.
29  * At present, http and rmi protocols are implemented.
30  * If null is returned, then the JDK uses sun.net.www.protocol.<protocol>.Handler.
31  *
32  * @return java.net.URLStreamHandler: The URL stream handler for this protocol.
33  * @param name String: The protocol name, e.g. "http".
34  * @author Arthur Ryman
35  *
36  */

37 public java.net.URLStreamHandler JavaDoc createURLStreamHandler(String JavaDoc protocol) {
38     if (protocol.equalsIgnoreCase ("http")) {
39         return new com.ibm.webdav.protocol.http.Handler ();
40     } else if (protocol.equalsIgnoreCase ("rmi")) {
41         return new com.ibm.webdav.protocol.rmi.Handler ();
42     }
43
44     return null;
45 }
46 }
47
Popular Tags