List of utility methods to do URL Parameter Builder
void | addParameter(Map add Parameter if (pair == null || pair.length() == 0) { return; int equalAt = pair.indexOf('='); String name; String value; if (equalAt > -1) { name = decodeUri(pair.substring(0, equalAt)); ... |
String | canonicalize(final SortedMap Canonicalize the query string. if (sortedParamMap == null || sortedParamMap.isEmpty()) { return ""; final StringBuilder sb = new StringBuilder(100); for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) { final String key = pair.getKey().toLowerCase(); if (IRRELEVANT_PARAMETERS.contains(key) || key.startsWith("utm_")) { continue; ... |
String | canonicalize(final SortedMap Canonicalize the query string. if (sortedParamMap == null || sortedParamMap.isEmpty()) { return ""; final StringBuffer sb = new StringBuffer(350); final Iterator<Map.Entry<String, String>> iter = sortedParamMap.entrySet().iterator(); while (iter.hasNext()) { final Map.Entry<String, String> pair = iter.next(); sb.append(percentEncodeRfc3986(pair.getKey())); ... |
String | constructParameterString(TreeMap construct Parameter String StringBuilder sb = new StringBuilder(); if (pPostParms != null) { String cp = ENCODING; for (String thisKey : pPostParms.keySet()) { String thisVal = pPostParms.get(thisKey); if (!thisVal.isEmpty()) { if (!(sb.length() == 0)) { sb.append(URL_AMPERSAND); ... |
String | convertHttpParameters(Map Useful method to convert a map of key,value pairs to a String to be used as part of a GET or POST content. Set<String> keySet = parameters.keySet(); StringBuilder convertedParameters = new StringBuilder(); for (String name : keySet) { convertedParameters.append(encode(name, defaultEncoding)); convertedParameters.append(nameValueSeparator); convertedParameters.append(encode(parameters.get(name), defaultEncoding)); convertedParameters.append(parameterSeparator); if (convertedParameters.length() > 0) convertedParameters.deleteCharAt(convertedParameters.length() - 1); return convertedParameters.toString(); |
String | convertToDataString(Map convert To Data String StringBuilder builder = new StringBuilder(); for (Map.Entry entry : data.entrySet()) { builder.append(URLEncoder.encode(entry.getKey().toString(), "UTF-8")).append("=") .append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")).append("&"); String result = builder.toString(); return result.length() > 0 ? result.substring(0, result.length() - 1) : ""; |
String | convertToParameterString(Map convert To Parameter String StringBuilder returnValue = new StringBuilder(); if (parameterMap != null) { try { for (Entry<String, Object> entry : parameterMap.entrySet()) { if (returnValue.length() > 0) returnValue.append("&"); returnValue.append(URLEncoder.encode(entry.getKey(), "UTF-8")); returnValue.append("="); ... |
Map | extractParameters(String parameterString) extract Parameters 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) { params.put(keyValue[0], decode(keyValue[1])); return params; |
String | format(final Map Returns a String that is suitable for use as an application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.
final StringBuilder result = new StringBuilder(); for (Map.Entry<String, Set<String>> parameter : parameters.entrySet()) { final String encodedName = encode(parameter.getKey(), encoding); final Set<String> values = parameter.getValue(); if (values == null || values.size() == 0) { result.append(encodedName); result.append(NAME_VALUE_SEPARATOR); result.append(""); ... |
String | format(Map format final StringBuilder result = new StringBuilder(); for (String key : parameters.keySet()) { final String encodedKey = URLEncoder.encode(key, (encoding != null ? encoding : DEFAULT_ENCODING)); final String value = parameters.get(key); final String encodedValue; if (value != null) { encodedValue = URLEncoder.encode(value, encoding != null ? encoding : DEFAULT_ENCODING); } else { ... |