01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jndi;
09:
10: //import java.net.URI;
11: //import java.net.URISyntaxException;
12:
13: /**
14: *
15: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
16: */
17:
18: public class URLUtil {
19: /*
20: public static String getHost(URI uri){
21: String host = uri.getHost();
22: if(host.trim().length() ==0 ) host = JNDIProperties.DEFAULT_HOST;
23: return host;
24: }
25:
26: public static int getPort(URI uri){
27: int port = uri.getPort();
28: if(port < 0) port = JNDIProperties.DEFAULT_PORT;
29: return port;
30: }
31:
32: public static String getScheme(URI uri){
33: String scheme = uri.getScheme();
34: if(scheme.trim().length() == 0) scheme = JNDIProperties.DEFAULT_SCHEME;
35: return scheme;
36: }
37:
38: public static String getProviderURL (URI uri) {
39: return getScheme(uri) + "://" + getHost(uri) + ":" + getPort(uri);
40: }
41:
42: public static URI getCompleteURL(URI uri) {
43: try {
44: if(uri.getPath().trim().length() != 0){
45: return new URI(getProviderURL(uri) + "/" + uri.getPath());
46: }
47: else {
48: return new URI(getProviderURL(uri));
49: }
50: }
51: catch(URISyntaxException e){
52: e.printStackTrace();
53: return uri;
54: }
55: }
56: */
57: }
|