Java URL Query Build getQueryMap(URL url)

Here you can find the source of getQueryMap(URL url)

Description

get Query Map

License

Open Source License

Declaration

private static Map<String, String> getQueryMap(URL url) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.URL;

import java.util.HashMap;

import java.util.Map;

public class Main {
    private static Map<String, String> getQueryMap(URL url) {
        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);/*  w w w .j  a  v  a  2 s.c  o m*/
            } catch (Exception e) {
                // malformed url params, just ignore
            }

        }
        return map;
    }
}

Related

  1. getQuery(Map params, String encode)
  2. getQuery(URL theURL)
  3. getQueryFromURL(URL url)
  4. getQueryMap(String query)
  5. getQueryMap(String urlString)
  6. getQueryParameter(String query, String key, String encoding)
  7. getQueryParameterMap(String queryString)
  8. getQueryParameters(URL url)
  9. getQueryParameters(URL url)