public static Map<String, String> parseParams(String s) {
        if (s == null || s.length() == 0)
            return Collections.emptyMap();
        Map<String, String> params = new LinkedHashMap<String, String>(8);
        Scanner sc = new Scanner(s).useDelimiter("&");
        while (sc.hasNext()) {
            String pair = sc.next();
            int pos = pair.indexOf('=');
            String name = pos == -1 ? pair : pair.substring(0, pos);
            String val = pos == -1 ? "" : pair.substring(pos + 1);
            try {
                name = URLDecoder.decode(name.trim(), "UTF-8");
                val = URLDecoder.decode(val.trim(), "UTF-8");
                if (name.length() > 0)
                    params.put(name, val);
            } catch (UnsupportedEncodingException ignore) {} // never thrown
        }
        return params;
    }