You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by hefeng <he...@163.com> on 2007/10/13 10:33:45 UTC

URI bug in HttpClient 3.1 Stable ?

Hi,
I have an URI like this:
/action/getTicket?ticketNo=dced6ca9fd63f916e4b5d||786

In HttpClient 3.01, the creation of org.apache.commons.httpclient.URI like
this:
new URI("/action/getTicket?ticketNo=dced6ca9fd63f916e4b5d||786")
would be successful. While later I switched to the latest version of 3.1
stable, the creation threw an URIException:
org.apache.commons.httpclient.URIException: Invalid query
	at
org.apache.commons.httpclient.URI.parseUriReference(URI.java:2049)
	at org.apache.commons.httpclient.URI.<init>(URI.java:167)
	at test.URLTest.main(URLTest.java:26)

I didn't research too deeply on this problem, but I knew it's caused by the
encoding of these two characters "||" in the query string. I have no idea
what changes in the latest version affects the URI's encoding.
Has anyone met this problem like mine? 

Hef



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: URI bug in HttpClient 3.1 Stable ?

Posted by Roland Weber <os...@dubioso.net>.
hefeng wrote:

> new URI("/action/getTicket?ticketNo=dced6ca9fd63f916e4b5d||786")

That constructor is deprecated because it was ambiguous. Use
"new URI(String, boolean)" and pass false as the second argument
to tell the URI class that it is supposed to escape the query string.

> I didn't research too deeply on this problem,

Looking into the JavaDocs would have saved you some time...
http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/URI.html

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org