Here you can find the source of getQueryParametersFromUrl(String url)
public static Map<String, String> getQueryParametersFromUrl(String url) throws IllegalArgumentException
//package com.java2s; //License from project: Apache License import java.net.URI; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getQueryParametersFromUrl(String url) throws IllegalArgumentException { if (url == null) throw new IllegalArgumentException("url == null"); URI uri = URI.create(url); String query = uri.getQuery(); if (query == null) return Collections.emptyMap(); String[] params = query.split("&"); Map<String, String> paramMap = new HashMap<>(); int mid;/*from w w w. ja v a 2s . co m*/ for (String param : params) { mid = param.indexOf('='); if (mid != -1) paramMap.put(param.substring(0, mid), param.substring(mid + 1)); } return paramMap; } }