List of utility methods to do URL Query Parse
Map | parse(String query, String encoding) parse Map<String, String> result = new HashMap<String, String>(); Scanner scanner = new Scanner(query); scanner.useDelimiter(PARAMETER_SEPARATOR); while (scanner.hasNext()) { String[] nameValue = scanner.next().split(NAME_VALUE_SEPARATOR); if (nameValue.length <= 0 || nameValue.length > 2) { continue; String name = decode(nameValue[0], encoding); String value = null; if (nameValue.length == 2) { value = decode(nameValue[1], encoding); result.put(name, value); return result; |
Properties | parseInstructions(final String query) Parses bnd instructions out of an url query string. final Properties instructions = new Properties(); if (query != null) { try { final String segments[] = query.split("&"); for (String segment : segments) { if (segment.trim().length() > 0) { final Matcher matcher = INSTRUCTIONS_PATTERN.matcher(segment); if (matcher.matches()) { ... |
Map | parseParameters(Optional parse Parameters Map<String, String[]> parameters = new HashMap<>(); if (!queryString.isPresent()) { return parameters; final String[] parametersParts = queryString.get().split("&"); for (String parametersPart : parametersParts) { String[] parameterParts = parametersPart.split("="); if (parameterParts.length < 2) { ... |
Map | parseParameters(String query) parse Parameters Map<String, String> params = new HashMap<>(); StringTokenizer st = new StringTokenizer(query, "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); String[] keyValuePair = token.split("="); String key = URLDecoder.decode(keyValuePair[0], "UTF-8"); String value = URLDecoder.decode(keyValuePair[1], "UTF-8"); params.put(key, value); ... |
Map | parseQuery(String query) parse Query Map<String, List<String>> params = new HashMap<String, List<String>>(); query = URLDecoder.decode(query, "UTF-8"); for (String param : query.split("&")) { String pair[] = param.split("="); String key = URLDecoder.decode(pair[0], "UTF-8"); String value = ""; if (pair.length > 1) { value = URLDecoder.decode(pair[1], "UTF-8"); ... |
Map | parseQuery(String query) Parsers the query string of the URI into a map of key-value pairs Map<String, String> answer = new HashMap<String, String>(); if (query != null) { StringTokenizer iter = new StringTokenizer(query, "&"); while (iter.hasMoreTokens()) { String pair = iter.nextToken(); addKeyValuePair(answer, pair); return answer; |
Hashtable | parseQuery(String query) Utility method to parse the query part of a URL into parameters. String[][] params = new String[200][2]; Hashtable<String, String> parameters = new Hashtable<String, String>(); String temp = ""; boolean ampflag = true; boolean poundflag = false; int arrcount = 0; if (query != null) { for (int i = 0; i < query.length(); i++) { ... |
Map | parseQuery(String query) parse Query Map<String, String> map = new HashMap<String, String>(); String[] entries = query.split("&"); for (String entry : entries) { String[] sides = entry.split("="); if (sides.length != 2) { throw new IOException("Invalid Query String"); String key = URLDecoder.decode(sides[0], "UTF-8"); ... |
Map | parseQuery(String query) Extract and decode query parameters from an encoded query string if (query == null || query.isEmpty()) return Collections.emptyMap(); Map<String, String> result = new HashMap<String, String>(); int top = query.length(); int start = 0; for (int idx = 0; idx < top; ++idx) { char c = query.charAt(idx); if (c == '&') { ... |
Map | parseQuery(String queryString) Get properties from a URI query string. if (queryString != null && !queryString.isEmpty()) { Map<String, String> rc = new HashMap<String, String>(); String[] parameters = queryString.split("&"); for (int i = 0; i < parameters.length; i++) { int p = parameters[i].indexOf("="); if (p >= 0) { String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); ... |