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 19 Jul 2003 19:34:37 -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.170 diff -u -r1.170 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 19 Jul 2003 09:41:37 -0000 1.170 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 19 Jul 2003 19:34:51 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v 1.170 2003/07/19 09:41:37 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v 1.170 2003/07/19 09:41:37 olegk Exp $ * $Revision: 1.170 $ * $Date: 2003/07/19 09:41:37 $ * @@ -266,26 +266,7 @@ if (uri == null || uri.equals("")) { uri = "/"; } - URI parsedURI = new URI(uri, true); - - // 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, true)); } catch (URIException e) { throw new IllegalArgumentException("Invalid uri '" + uri + "': " + e.getMessage() @@ -337,6 +318,35 @@ } + } + + /** + * 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()) { + if (this.hostConfiguration == null) { + this.hostConfiguration = new HostConfiguration(); + } + this.hostConfiguration.setHost( + uri.getHost(), + uri.getPort(), + uri.getScheme() + ); + } + + // set the path, defaulting to root + setPath( + uri.getPath() == null + ? "/" + : uri.getEscapedPath() + ); + setQueryString(uri.getEscapedQuery()); } /**