Michael Becke wrote:

I propose that we:
- form urlencode values passed to HttpMethodBase.setQueryString(NameValuePair[])
- use java.net.URLEncoder for form urlencoding

I agree, as long as URLEncoder seems to work.


Do you think we need to modify URI so that it uses URLEncoder to encode the query part of URIs? In cases where a client has a URL string that may or may not contain query parameters, it would lead to a slightly more natural API usage:
HttpMethod meth = new GetMethod(new URI(urlString));
as opposed to
String query = null;
int index = urlString.indexOf('?');
if (index != -1) {
query = urlString.substring(index+1);
urlString = urlString.substring(0, index);
}
HttpMethod meth = new GetMethod(new URI(urlString));
meth.setQueryString(java.net.URLEncoder.encode(query));
or something like that, with error checking of course.


I'm not sure how much I care, though. If my fetching code had been constructed using the HttpClient code from scratch, I wouldn't even have the query parameters in the string in the first place; I'd just add them with setQueryString.

I'll see if I can work up a preliminary patch for this stuff later tonight or tomorrow morning.

Adrian Sutton wrote:

I know in the product we develop, we switched away from using java.net.URLEncoder because it didn't work properly

FWIW, we're using it and haven't seen any problems. But we've been on 1.2 or higher since I started at BeVocal. (We're moving to 1.4 now because the server VM performance is *much* better.)


--Laura



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to