List of utility methods to do URL Query Build
Map | getQueryMap(URL url) get Query Map String query = url.getQuery(); String[] params = query.split("&"); Map<String, String> map = new HashMap<String, String>(); for (String param : params) { try { String name = param.split("=")[0]; String value = param.split("=")[1]; map.put(name, value); ... |
String | getQueryParameter(String query, String key, String encoding) get Query Parameter Map<String, String> result = parse(query, encoding); if (result == null) { return null; } else { return result.get(key); |
Map | getQueryParameterMap(String queryString) URL-decodes names and values Map<String, String> parameters = new HashMap<String, String>(); if (queryString != null && queryString.trim().length() > 0) { for (String pair : queryString.split("&")) { int equals = pair.indexOf('='); if (equals == 0) throw new IllegalArgumentException("invalid query parameter: " + pair); String key = equals > 0 ? pair.substring(0, equals) : pair; String value = equals > 0 ? pair.substring(equals + 1) : null; ... |
Map | getQueryParameters(URL url) get Query Parameters String q = url.getQuery(); if (q != null) { String[] qs = q.split("&"); Map<String, String> queryParameters = new LinkedHashMap<>(qs.length); for (String qp : qs) { String[] qps = qp.split("="); if (qps.length == 2) { queryParameters.put(qps[0], qps[1]); ... |
Map | getQueryParameters(URL url) Retrieve query parameters map from String representation of url Map<String, List<String>> params = new HashMap<>(); String query = url.getQuery(); if (query != null) { for (String param : query.split("&")) { String pair[] = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = null; if (pair.length > 1) { ... |
Map | getQueryParameters(URL url) get Query Parameters Map<String, String> params = new HashMap<String, String>(); String q = url.getQuery(); if (q == null) return params; try { for (String p : q.split("&")) { String[] values = p.split("=", 2); if (values.length != 2) ... |
Map | getQueryParametersFromUrl(String url) get Query Parameters From Url 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<>(); ... |
Map | getQueryParams(String httpUrl) get Query Params Map<String, String> params = new HashMap<String, String>(); if (httpUrl == null) { return params; URL url = null; try { url = new URL(httpUrl); } catch (MalformedURLException e) { ... |
Map | getQueryParams(String query) get Query Params try { Map<String, String> params = new HashMap<String, String>(); for (String param : query.split("&")) { String[] pair = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = URLDecoder.decode(pair[1], "UTF-8"); params.put(key, value); return params; } catch (UnsupportedEncodingException ex) { throw new AssertionError(ex); |
Map | getQueryParams(String s) Get traditional query parameters as a Java map Map<String, String> params = new HashMap<String, String>(); for (String kv : s.split("&")) { String[] parts = kv.split("="); if (parts.length != 2) { throw new MalformedURLException(); try { String k = URLDecoder.decode(parts[0], "UTF-8"); ... |