Here you can find the source of getUrlParameters(String url)
public static Map<String, String> getUrlParameters(String url) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getUrlParameters(String url) throws UnsupportedEncodingException { Map<String, String> params = new HashMap<>(); String query = url.substring(url.indexOf("?") + 1); for (String param : query.split("\n\t")) { String pair[] = param.split("="); if (pair.length < 2) continue; String key = URLDecoder.decode(pair[0].replaceAll("&", ""), "utf-8"); String value = ""; if (pair.length > 1) { try { value = URLDecoder.decode(pair[1], "utf-8"); } catch (Exception e) { value = pair[1];/* w w w. j a va2 s .c o m*/ } } if (key != null && !key.trim().isEmpty()) params.put(key.toLowerCase(), value); } return params; } }