Is there a Java method that encodes a collection of parameters as a URL query component?
- by Steven Huwig
Is there a widely-used Java library that does something like what dojo.objectToQuery() does? E.g. (assuming the use of HttpCore's HttpParams object, but any key-value mapping will do):
HttpParams params = new BasicHttpParams()
.setParameter("foo", "bar")
.setParameter("thud", "grunt");
UnknownLibrary.toQueryString(params);
should yield "foo=bar&thud=grunt".
I know it's not hard to write but it seems like it should have already been written. I just can't find it.