Is there a Java method that encodes a collection of parameters as a URL query component?
Posted
by Steven Huwig
on Stack Overflow
See other posts from Stack Overflow
or by Steven Huwig
Published on 2009-09-10T14:47:31Z
Indexed on
2010/03/25
23:13 UTC
Read the original article
Hit count: 271
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.
© Stack Overflow or respective owner