The following snippet should work:
return new URI(url.toString()).getEscapedURIReference();
This will return an escaped URI string value. This value is suitable for passing to the various Method constructors.
Mike
On Nov 25, 2003, at 7:26 AM, <[EMAIL PROTECTED]> wrote:
Hello,
Is there an easy way to convert a java.net.URL to something HttpClient can use, with appropriate encoding?
I'm now using:
URL url=...;
String path=url.getPath()==null ? url.getPath() : URIUtil.encodePath(url.getPath());
String query=url.getQuery()==null ? url.getQuery() : URIUtil.encodeQuery(url.getQuery());
return new URI(
url.getProtocol(),
url.getUserInfo(),
url.getHost(),
url.getPort(),
path,
query,
url.getRef())
.toString();
Erwin Vervaet
= = = = = = = = = = = = = = = = = = = = = = = = = Fortis Bank disclaimer : http://www.fortisbank.be/legal/disclaimer.htm
Fortis Bank privacy policy : http://www.fortisbank.be/legal/privacy_policy.htm = = = = = = = = = = = = = = = = = = = = = = = = =
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
