List of utility methods to do URL Parameter Builder
Map | parseParameters(final String value) Parse the given application/x-www-form-urlencoded String and return the parameters as a (name/value) Map. if (value == null || value.isEmpty()) { return Collections.emptyMap(); final Map<String, String> map = new HashMap<String, String>(); final Matcher m = KEY_VALUES.matcher(value); while (m.find()) { map.put(decodeRfc5849(m.group(1)), decodeRfc5849(m.group(2))); return map; |
HashMap | parseResponseParams(String body) parse Response Params HashMap<String, String> results = new HashMap<String, String>(); for (String keyValuePair : body.split("&")) { String[] kvp = keyValuePair.split("="); results.put(kvp[0], URLDecoder.decode(kvp[1], "UTF-8")); return results; |
boolean | sendGetRequest(String path, Map send Get Request StringBuilder sb = new StringBuilder(path); sb.append('?'); for (Map.Entry<String, String> entry : params.entrySet()) { sb.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), enc)).append('&'); sb.deleteCharAt(sb.length() - 1); URL url = new URL(sb.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); ... |
boolean | sendPostRequest(String path, Map send Post Request StringBuilder sb = new StringBuilder(); if (params != null && !params.isEmpty()) { for (Map.Entry<String, String> entry : params.entrySet()) { sb.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), enc)).append('&'); sb.deleteCharAt(sb.length() - 1); byte[] entitydata = sb.toString().getBytes(); ... |
String | serializeParameters(final Map serialize Parameters try { final StringBuilder sb = new StringBuilder(); final Iterator<Map.Entry<String, String>> iterator = parameters.entrySet().iterator(); if (iterator.hasNext()) { Map.Entry<String, String> entry; String key; String encodedKey; String value; ... |
String | serializeParameters(final Map Serialises the specified map of parameters into a URL query string. if (params == null || params.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry : params.entrySet()) { if (entry.getKey() == null) continue; String value = entry.getValue() != null ? entry.getValue() : ""; try { ... |
Map | stringToMap(String input) string To Map Map<String, Object> map = new HashMap<String, Object>(); String[] nameValuePairs = input.split("&"); for (String nameValuePair : nameValuePairs) { String[] nameValue = nameValuePair.split("="); try { if (isParsable(nameValue[1])) { map.put(URLDecoder.decode(nameValue[0], "UTF-8"), (int) Integer.parseInt(nameValue[1])); } else { ... |
Map | stringToMap(String input) string To Map Map<String, String> map = new HashMap<String, String>(); String[] nameValuePairs = input.split("&"); for (String nameValuePair : nameValuePairs) { String[] nameValue = nameValuePair.split("="); try { map.put(URLDecoder.decode(nameValue[0], "UTF-8"), nameValue.length > 1 ? URLDecoder.decode(nameValue[1], "UTF-8") : ""); } catch (UnsupportedEncodingException e) { ... |
String | stringUncode(String param) string Uncode if (param != null && !param.trim().equals("")) { try { param = URLDecoder.decode(param, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return param; ... |