Parse a URI query string, returning a list of Name/Value pairs in the order they occur in the query and keeping duplicates. @param query a decoded URI query string. @return ordered list name/value pairs.
(String query)
| 407 | * @return ordered list name/value pairs. |
| 408 | */ |
| 409 | public static List<NameValuePair> parseQueryOrdered(String query) throws URISyntaxException { |
| 410 | List<NameValuePair> parameters = new ArrayList<NameValuePair>(); |
| 411 | if (query == null) { |
| 412 | return parameters; |
| 413 | } |
| 414 | URIQueryTokenizer uqt = new URIQueryTokenizer(query); |
| 415 | while (uqt.hasMoreTokens()) { |
| 416 | String token = uqt.nextToken(); |
| 417 | int index = token.indexOf(URI.PARAMETER_SEPARATOR); |
| 418 | String name; |
| 419 | String value; |
| 420 | if (index != -1) { |
| 421 | name = token.substring(0, index); |
| 422 | value = token.substring(index + 1); |
| 423 | } else { |
| 424 | name = token; |
| 425 | value = null; |
| 426 | } |
| 427 | parameters.add(new NameValuePair(name, value)); |
| 428 | } |
| 429 | return parameters; |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * Build a URI query string, from a list of Name/Value pairs. This version |
no test coverage detected