jericho 02/03/21 04:34:22
Modified: src/util/org/apache/util GenericURI.java
Added: src/util/org/apache/util HttpsURL.java URI.java
Log:
- Add URI interface
- Add HttpsURL class
- Make GenericURI class Implement URI interface
Revision Changes Path
1.7 +4 -4 jakarta-slide/src/util/org/apache/util/GenericURI.java
Index: GenericURI.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/util/org/apache/util/GenericURI.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- GenericURI.java 17 May 2001 02:27:09 -0000 1.6
+++ GenericURI.java 21 Mar 2002 12:34:22 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/util/org/apache/util/GenericURI.java,v 1.6
2001/05/17 02:27:09 jericho Exp $
- * $Revision: 1.6 $
- * $Date: 2001/05/17 02:27:09 $
+ * $Header: /home/cvs/jakarta-slide/src/util/org/apache/util/GenericURI.java,v 1.7
2002/03/21 12:34:22 jericho Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/03/21 12:34:22 $
*
* ====================================================================
*
@@ -80,7 +80,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Park, Sung-Gu</a>
*/
-public abstract class GenericURI implements java.io.Serializable {
+public abstract class GenericURI implements URI, java.io.Serializable {
// --------------------------------------------------------- Constructors
1.1 jakarta-slide/src/util/org/apache/util/HttpsURL.java
Index: HttpsURL.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/util/org/apache/util/HttpsURL.java,v 1.1
2002/03/21 12:34:22 jericho Exp $
* $Revision: 1.1 $
* $Date: 2002/03/21 12:34:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.util;
/**
* This is for the HTTPS URL of the generic URI version.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sung-Gu</a>
*/
public class HttpsURL extends HttpURL {
// --------------------------------------------------------- Constructors
/**
* This Constructor
*
* @param escapedHttpsURL The escaped https URL string.
*/
public HttpsURL(String escapedHttpsURL) {
super(escapedHttpsURL);
setDefaultScheme(scheme);
setDefaultPort(port);
}
/**
* This Constructor
*
* @param host The host string.
* @param path The path string.
*/
public HttpsURL(String host, String path) {
this(null, null, host, HttpsURL.port, path, null);
}
/**
* This Constructor
*
* @param host The host string.
* @param port The port number.
* @param path The path string.
*/
public HttpsURL(String host, int port, String path) {
this(null, null, host, port, path, null);
}
/**
* This Constructor
*
* @param host The host string.
* @param port The port number.
* @param path The path string.
* @param query The query string.
*/
public HttpsURL(String host, int port, String path, String query) {
this(null, null, host, port, path, query);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
*/
public HttpsURL(String userName, String password, String host) {
this(userName, password, host, HttpsURL.port, null, null);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
* @param port The port number.
*/
public HttpsURL(String userName, String password, String host, int port) {
this(userName, password, host, port, null, null);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
* @param path The path string.
*/
public HttpsURL(String userName, String password, String host,
String path) {
this(userName, password, host, HttpsURL.port, path, null);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
* @param port The port number.
* @param path The path string.
*/
public HttpsURL(String userName, String password, String host, int port,
String path) {
this(userName, password, host, port, path, null);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
* @param path The path string.
* @param query The query string.
*/
public HttpsURL(String userName, String password, String host,
String path, String query) {
this(userName, password, host, HttpsURL.port, path, query);
}
/**
* This Constructor
*
* @param userName The username string.
* @param password The password string.
* @param host The host string.
* @param port The port number.
* @param path The path string.
* @param query The query string.
*/
public HttpsURL(String userName, String password, String host, int port,
String path, String query) {
super
(URIUtil.escape(HttpsURL.scheme, URIUtil.schemeReserved()) + "://" +
((userName == null) ? "" :
URIUtil.escape(userName) + ((password == null) ? "" :
":" + URIUtil.escape(password))
+ "@") +
URIUtil.escape(host, URIUtil.hostReserved()) +
((port == HttpsURL.port || port == -1) ? "" : ":" + port) +
((path == null || path.equals("")) ? "/" :
URIUtil.escape((!path.startsWith("/")) ?
"/" + path : path, URIUtil.pathReserved())) +
((query == null || query.equals("")) ? "" :
"?" + URIUtil.escape(query, URIUtil.queryReserved())));
setDefaultScheme(scheme);
setDefaultPort(port);
}
/**
* This Constructor
*
* @param httpsURL The https URL.
* @param path The added relative path.
*/
public HttpsURL(HttpsURL httpsURL, String path) {
this(httpsURL.toString() +
(httpsURL.toString().endsWith("/") ? "" : "/") +
URIUtil.escape(path, URIUtil.pathReserved()));
}
// ------------------------------------------------------------ Constants
/**
* Default scheme for HTTPS URL.
*/
public final static String scheme = "https";
/**
* Default port for HTTPS URL.
*/
public final static int port = 443;
/**
* The serialVersionUID.
*/
static final long serialVersionUID = 887844277028676647L;
// ------------------------------------------------------ Public Methods
}
1.1 jakarta-slide/src/util/org/apache/util/URI.java
Index: URI.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/util/org/apache/util/URI.java,v 1.1
2002/03/21 12:34:22 jericho Exp $
* $Revision: 1.1 $
* $Date: 2002/03/21 12:34:22 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.util;
/**
* The interface for the URI(Uniform Resource Identifiers) version of RFC 2396.
*
* URI Syntactic Components
* - In general, written as follows:
* Absolute URI = <scheme>:<scheme-specific-part>
* Generic URI = <scheme>://<authority><path>?<query>
* - Syntax
* absoluteURI = scheme ":" ( hier_part | opaque_part )
* hier_part = ( net_path | abs_path ) [ "?" query ]
* net_path = "//" authority [ abs_path ]
* abs_path = "/" path_segments
*
* The following examples illustrate URI that are in common use.
* ftp://ftp.is.co.za/rfc/rfc1808.txt
* -- ftp scheme for File Transfer Protocol services
* gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles
* -- gopher scheme for Gopher and Gopher+ Protocol services
* http://www.math.uio.no/faq/compression-faq/part1.html
* -- http scheme for Hypertext Transfer Protocol services
* mailto:[EMAIL PROTECTED]
* -- mailto scheme for electronic mail addresses
* news:comp.infosystems.www.servers.unix
* -- news scheme for USENET news groups and articles
* telnet://melvyl.ucop.edu/
* -- telnet scheme for interactive services via the TELNET Protocol
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sung-Gu</a>
* @version $Revision: 1.1 $ $Date: 2002/03/14 15:14:01
*/
public interface URI {
/**
* Get the scheme for the URI.
*
* @return The scheme for the URI.
*/
public String getScheme() throws Exception;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>