Here you can find the source of extractParameters(String parameterString)
private static Map<String, String> extractParameters(String parameterString)
//package com.java2s; /*/*w w w .j ava 2s .com*/ * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; public class Main { private static Map<String, String> extractParameters(String parameterString) { Map<String, String> params = new HashMap<String, String>(); if (parameterString != null) { String[] paramPairs = parameterString.split("&"); for (String pair : paramPairs) { String[] keyValue = pair.split("="); if (keyValue.length == 2) { // TODO: Determine if this decode step is necessary, since it's just going to be encoded again later params.put(keyValue[0], decode(keyValue[1])); } } } return params; } private static String decode(String encoded) { try { return URLDecoder.decode(encoded, "UTF-8"); } catch (UnsupportedEncodingException shouldntHappen) { return encoded; } } }