Here you can find the source of getUrlParameters(String url)
public static Map<String, String> getUrlParameters(String url)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.URLDecoder; import java.util.*; public class Main { public static Map<String, String> getUrlParameters(String url) { Map<String, String> params = new HashMap<String, String>(); String[] urlParts = url.split("\\?"); String query = ""; if (urlParts.length > 0) { query = urlParts[0];//from w ww . j av a 2s .co m } if (urlParts.length > 1) { query = urlParts[1]; } if (!query.equals("")) { for (String param : query.split("&")) { String pair[] = param.split("="); try { String key = URLDecoder.decode(pair[0], "UTF-8"); String value = ""; if (pair.length > 1) { value = URLDecoder.decode(pair[1], "UTF-8"); } params.put(key, value); } catch (UnsupportedEncodingException ex) { //ignore, fuck you java } } } return params; } }