Java EE has ServletRequest.getParameterValues().
On non-EE platforms, URL.getQuery() simply returns a string.
What\'s the normal way to properly parse the qu
This works for me.. I'm not sure why every one was after a Map, List> All I needed was a simple name value Map.
To keep things simple I used the build in URI.getQuery();
public static Map getUrlParameters(URI uri)
throws UnsupportedEncodingException {
Map params = new HashMap();
for (String param : uri.getQuery().split("&")) {
String pair[] = param.split("=");
String key = URLDecoder.decode(pair[0], "UTF-8");
String value = "";
if (pair.length > 1) {
value = URLDecoder.decode(pair[1], "UTF-8");
}
params.put(new String(key), new String(value));
}
return params;
}