Java URI Parse parseUriParameters(URI uri)

Here you can find the source of parseUriParameters(URI uri)

Description

parse Uri Parameters

License

Apache License

Declaration

public static LinkedListMultimap<String, String> parseUriParameters(URI uri) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.URI;

import com.google.common.collect.LinkedListMultimap;

public class Main {
    public static LinkedListMultimap<String, String> parseUriParameters(URI uri) {
        LinkedListMultimap<String, String> params = LinkedListMultimap.create();
        String query = uri.getQuery();
        if (query != null) {
            for (String param : query.split("&")) {
                String[] kv = param.split("=");
                if (kv.length >= 2) {
                    params.put(kv[0], param.substring(kv[0].length() + 1));
                } else {
                    params.put(kv[0], "");
                }/*www  .j a v a  2s .  c o  m*/
            }
        }
        return params;
    }
}

Related

  1. parseURI(final String value)
  2. parseURI(String connectionString, URI defaultURI)
  3. parseUri(String s)
  4. parseURI(String target)
  5. parseURI(String uriStr)
  6. parseUriQueryParams(URI uri)
  7. parseURIs(String uri)