Index: java/org/apache/commons/httpclient/HttpMethod.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v retrieving revision 1.23 diff -u -r1.23 HttpMethod.java --- java/org/apache/commons/httpclient/HttpMethod.java 28 Jan 2003 04:40:20 -0000 1.23 +++ java/org/apache/commons/httpclient/HttpMethod.java 18 Jul 2003 12:55:45 -0000 @@ -126,6 +126,15 @@ URI getURI() throws URIException; /** + * Sets the URI for this method. + * + * @param uri URI to be set + * + * @throws URIException if a URI cannot be set + */ + void setURI(URI uri) throws URIException; + + /** *

Turns strict mode on or off. In strict mode (the default) we * following the letter of RFC 2616, the Http 1.1 specification. If strict * mode is turned off we attempt to violate the specification in the same Index: java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.169 diff -u -r1.169 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 16 Jul 2003 20:48:27 -0000 1.169 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 18 Jul 2003 12:55:47 -0000 @@ -259,33 +259,12 @@ */ public HttpMethodBase(String uri) throws IllegalArgumentException, IllegalStateException { - try { - // create a URI and allow for null/empty uri values if (uri == null || uri.equals("")) { uri = "/"; } - URI parsedURI = new URI(uri.toCharArray()); - - // only set the host if specified by the URI - if (parsedURI.isAbsoluteURI()) { - hostConfiguration = new HostConfiguration(); - hostConfiguration.setHost( - parsedURI.getHost(), - parsedURI.getPort(), - parsedURI.getScheme() - ); - } - - // set the path, defaulting to root - setPath( - parsedURI.getPath() == null - ? "/" - : parsedURI.getEscapedPath() - ); - setQueryString(parsedURI.getEscapedQuery()); - + setURI(new URI(uri.toCharArray())); } catch (URIException e) { throw new IllegalArgumentException("Invalid uri '" + uri + "': " + e.getMessage() @@ -337,6 +316,33 @@ } + } + + /** + * Sets the URI for this method. + * + * @param uri URI to be set + * + * @throws URIException if a URI cannot be set + */ + public void setURI(URI uri) throws URIException { + // only set the host if specified by the URI + if (uri.isAbsoluteURI()) { + hostConfiguration = new HostConfiguration(); + hostConfiguration.setHost( + uri.getHost(), + uri.getPort(), + uri.getScheme() + ); + } + + // set the path, defaulting to root + setPath( + uri.getPath() == null + ? "/" + : uri.getEscapedPath() + ); + setQueryString(uri.getEscapedQuery()); } /**