Index: java/org/apache/commons/httpclient/HttpURL.java =================================================================== retrieving revision 1.12 diff -u -r1.12 HttpURL.java --- java/org/apache/commons/httpclient/HttpURL.java 4 Apr 2003 02:37:02 -0000 1.12 +++ java/org/apache/commons/httpclient/HttpURL.java 28 Jan 2004 10:20:50 -0000 @@ -444,7 +444,7 @@ * @return the scheme */ public char[] getRawScheme() { - return (_scheme == null) ? null : DEFAULT_SCHEME; + return (_scheme == null) ? null : HttpURL.DEFAULT_SCHEME; } @@ -454,7 +454,7 @@ * @return the scheme null if empty or undefined */ public String getScheme() { - return (_scheme == null) ? null : new String(DEFAULT_SCHEME); + return (_scheme == null) ? null : new String(HttpURL.DEFAULT_SCHEME); } // --------------------------------------------------------------- The port @@ -464,7 +464,7 @@ * @return the port number */ public int getPort() { - return (_port == -1) ? DEFAULT_PORT : _port; + return (_port == -1) ? HttpURL.DEFAULT_PORT : _port; } // ----------------------------------------------------------- The userinfo Index: java/org/apache/commons/httpclient/HttpsURL.java =================================================================== retrieving revision 1.6 diff -u -r1.6 HttpsURL.java --- java/org/apache/commons/httpclient/HttpsURL.java 13 Feb 2003 05:08:18 -0000 1.6 +++ java/org/apache/commons/httpclient/HttpsURL.java 28 Jan 2004 10:20:50 -0000 @@ -440,6 +440,37 @@ */ static final long serialVersionUID = 887844277028676648L; + // ------------------------------------------------------------- The scheme + + /** + * Get the scheme. You can get the scheme explicitly. + * + * @return the scheme + */ + public char[] getRawScheme() { + return (_scheme == null) ? null : HttpsURL.DEFAULT_SCHEME; + } + + + /** + * Get the scheme. You can get the scheme explicitly. + * + * @return the scheme null if empty or undefined + */ + public String getScheme() { + return (_scheme == null) ? null : new String(HttpsURL.DEFAULT_SCHEME); + } + + // --------------------------------------------------------------- The port + + /** + * Get the port number. + * @return the port number + */ + public int getPort() { + return (_port == -1) ? HttpsURL.DEFAULT_PORT : _port; + } + // ---------------------------------------------------------------- Utility /** Index: test/org/apache/commons/httpclient/TestURI.java =================================================================== retrieving revision 1.4.2.1 diff -u -r1.4.2.1 TestURI.java --- test/org/apache/commons/httpclient/TestURI.java 23 Sep 2003 13:04:14 -0000 1.4.2.1 +++ test/org/apache/commons/httpclient/TestURI.java 28 Jan 2004 10:20:54 -0000 @@ -112,6 +112,16 @@ } + public void testUrl() throws URIException { + URI url = new HttpURL("http://jakarta.apache.org"); + assertEquals(80, url.getPort()); + assertEquals("http", url.getScheme()); + + url = new HttpsURL("https://jakarta.apache.org"); + assertEquals(443, url.getPort()); + assertEquals("https", url.getScheme()); + } + /** * Tests the URI(URI, String) constructor. This tests URIs ability to * resolve relative URIs.