Index: examples/CustomHttpConnection.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/examples/CustomHttpConnection.java,v
retrieving revision 1.3
diff -u -r1.3 CustomHttpConnection.java
--- examples/CustomHttpConnection.java 22 Apr 2003 18:11:01 -0000 1.3
+++ examples/CustomHttpConnection.java 18 Jul 2003 08:51:13 -0000
@@ -89,7 +89,7 @@
System.exit(1);
}
- URI uri = new URI(args[0].toCharArray()); // i like this constructor :)
+ URI uri = new URI(args[0], true);
String schema = uri.getScheme();
if ((schema == null) || (schema.equals("")))
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 08:51:16 -0000
@@ -266,7 +266,7 @@
if (uri == null || uri.equals("")) {
uri = "/";
}
- URI parsedURI = new URI(uri.toCharArray());
+ URI parsedURI = new URI(uri, true);
// only set the host if specified by the URI
if (parsedURI.isAbsoluteURI()) {
@@ -1120,7 +1120,7 @@
conn.getPort(),
this.getPath()
);
- redirectUri = new URI(location.toCharArray());
+ redirectUri = new URI(location, true);
if (redirectUri.isRelativeURI()) {
if (isStrictMode()) {
LOG.warn("Redirected location '" + location
Index: java/org/apache/commons/httpclient/URI.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java,v
retrieving revision 1.38
diff -u -r1.38 URI.java
--- java/org/apache/commons/httpclient/URI.java 11 Jul 2003 21:55:09 -0000 1.38
+++ java/org/apache/commons/httpclient/URI.java 18 Jul 2003 08:51:19 -0000
@@ -154,6 +154,41 @@
protected URI() {
}
+ /**
+ * Construct a URI from a string with the given charset. The input string can
+ * be either in escaped or unescaped form.
+ *
+ * @param s URI character sequence
+ * @param escaped whether URI character sequence is in escaped form
+ * @param charset the charset string to do escape encoding, if required
+ *
+ * @throws URIException If the URI cannot be created.
+ * @throws NullPointerException if escaped is null
+ *
+ * @see #getProtocolCharset
+ */
+ public URI(String s, boolean escaped, String charset)
+ throws URIException, NullPointerException {
+ protocolCharset = charset;
+ parseUriReference(s, escaped);
+ }
+
+ /**
+ * Construct a URI from a string with the given charset. The input string can
+ * be either in escaped or unescaped form.
+ *
+ * @param s URI character sequence
+ * @param escaped whether URI character sequence is in escaped form
+ *
+ * @throws URIException If the URI cannot be created.
+ * @throws NullPointerException if escaped is null
+ *
+ * @see #getProtocolCharset
+ */
+ public URI(String s, boolean escaped)
+ throws URIException, NullPointerException {
+ parseUriReference(s, escaped);
+ }
/**
* Construct a URI as an escaped form of a character array with the given
@@ -164,6 +199,8 @@
* @throws URIException If the URI cannot be created.
* @throws NullPointerException if escaped is null
* @see #getProtocolCharset
+ *
+ * @deprecated Use #URI(String, boolean, String)
*/
public URI(char[] escaped, String charset)
throws URIException, NullPointerException {
@@ -181,6 +218,8 @@
* @throws URIException If the URI cannot be created.
* @throws NullPointerException if escaped is null
* @see #getDefaultProtocolCharset
+ *
+ * @deprecated Use #URI(String, boolean)
*/
public URI(char[] escaped)
throws URIException, NullPointerException {
@@ -196,6 +235,8 @@
* @param charset the charset string to do escape encoding
* @throws URIException If the URI cannot be created.
* @see #getProtocolCharset
+ *
+ * @deprecated Use #URI(String, boolean, String)
*/
public URI(String original, String charset) throws URIException {
protocolCharset = charset;
@@ -215,6 +256,8 @@
* It is one of absoluteURI and relativeURI.
* @throws URIException If the URI cannot be created.
* @see #getDefaultProtocolCharset
+ *
+ * @deprecated Use #URI(String, boolean)
*/
public URI(String original) throws URIException {
parseUriReference(original, false);
Index: test/org/apache/commons/httpclient/TestURI.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURI.java,v
retrieving revision 1.4
diff -u -r1.4 TestURI.java
--- test/org/apache/commons/httpclient/TestURI.java 19 Jun 2003 23:28:20 -0000 1.4
+++ test/org/apache/commons/httpclient/TestURI.java 18 Jul 2003 08:51:20 -0000
@@ -96,7 +96,7 @@
URI baseURI = null;
try {
- baseURI = new URI( "http://a/b/c/d;p?q" );
+ baseURI = new URI("http://a/b/c/d;p?q", false);
} catch ( URIException e ) {
fail( "unable to create base URI: " + e );
}