KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > tomcat > internal > JndiURLHandler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.tomcat.internal;
12 import java.net.*;
13
14 import org.apache.naming.resources.*;
15 import org.osgi.service.url.*;
16
17 public class JndiURLHandler extends DirContextURLStreamHandler
18         implements
19             URLStreamHandlerService {
20     public URLConnection openConnection(URL u) throws java.io.IOException JavaDoc {
21         return super.openConnection(u);
22     }
23
24     /**
25      * The <tt>URLStreamHandlerSetter</tt> object passed to the parseURL
26      * method.
27      */

28     protected URLStreamHandlerSetter realHandler;
29
30     /**
31      * Parse a URL using the <tt>URLStreamHandlerSetter</tt> object. This
32      * method sets the <tt>realHandler</tt> field with the specified
33      * <tt>URLStreamHandlerSetter</tt> object and then calls
34      * <tt>parseURL(URL,String,int,int)</tt>.
35      *
36      * @param realHandler
37      * The object on which the <tt>setURL</tt> method must be
38      * invoked for the specified URL.
39      * @see "java.net.URLStreamHandler.parseURL"
40      */

41     public void parseURL(URLStreamHandlerSetter realHandler, URL u,
42             String JavaDoc spec, int start, int limit) {
43         this.realHandler = realHandler;
44         parseURL(u, spec, start, limit);
45     }
46
47     /**
48      * This method calls <tt>super.toExternalForm</tt>.
49      *
50      * @see "java.net.URLStreamHandler.toExternalForm"
51      */

52     public String JavaDoc toExternalForm(URL u) {
53         return super.toExternalForm(u);
54     }
55
56     /**
57      * This method calls <tt>super.equals(URL,URL)</tt>.
58      *
59      * @see "java.net.URLStreamHandler.equals(URL,URL)"
60      */

61     public boolean equals(URL u1, URL u2) {
62         return super.equals(u1, u2);
63     }
64
65     /**
66      * This method calls <tt>super.getDefaultPort</tt>.
67      *
68      * @see "java.net.URLStreamHandler.getDefaultPort"
69      */

70     public int getDefaultPort() {
71         return super.getDefaultPort();
72     }
73
74     /**
75      * This method calls <tt>super.getHostAddress</tt>.
76      *
77      * @see "java.net.URLStreamHandler.getHostAddress"
78      */

79     public InetAddress getHostAddress(URL u) {
80         return super.getHostAddress(u);
81     }
82
83     /**
84      * This method calls <tt>super.hashCode(URL)</tt>.
85      *
86      * @see "java.net.URLStreamHandler.hashCode(URL)"
87      */

88     public int hashCode(URL u) {
89         return super.hashCode(u);
90     }
91
92     /**
93      * This method calls <tt>super.hostsEqual</tt>.
94      *
95      * @see "java.net.URLStreamHandler.hostsEqual"
96      */

97     public boolean hostsEqual(URL u1, URL u2) {
98         return super.hostsEqual(u1, u2);
99     }
100
101     /**
102      * This method calls <tt>super.sameFile</tt>.
103      *
104      * @see "java.net.URLStreamHandler.sameFile"
105      */

106     public boolean sameFile(URL u1, URL u2) {
107         return super.sameFile(u1, u2);
108     }
109
110     /**
111      * This method calls
112      * <tt>realHandler.setURL(URL,String,String,int,String,String)</tt>.
113      *
114      * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
115      * @deprecated This method is only for compatibility with handlers written
116      * for JDK 1.1.
117      */

118     protected void setURL(URL u, String JavaDoc proto, String JavaDoc host, int port,
119             String JavaDoc file, String JavaDoc ref) {
120         realHandler.setURL(u, proto, host, port, file, ref);
121     }
122
123     /**
124      * This method calls
125      * <tt>realHandler.setURL(URL,String,String,int,String,String,String,String)</tt>.
126      *
127      * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
128      */

129     protected void setURL(URL u, String JavaDoc proto, String JavaDoc host, int port,
130             String JavaDoc auth, String JavaDoc user, String JavaDoc path, String JavaDoc query, String JavaDoc ref) {
131         realHandler.setURL(u, proto, host, port, auth, user, path, query, ref);
132     }
133 }
134
Popular Tags