Android URL Parameter Get getQueryUrl(final String url)

Here you can find the source of getQueryUrl(final String url)

Description

get Query Url

Declaration

public static URL getQueryUrl(final String url) 

Method Source Code

//package com.java2s;
import java.net.URI;
import java.net.URL;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;

public class Main {
    public static URL getQueryUrl(final String url) {
        URL queryUrl = null;//w  w  w  .  j av a2s  .  c om
        try {
            List<NameValuePair> queries = URLEncodedUtils.parse(
                    new URI(url), "UTF-8");
            for (NameValuePair pair : queries) {
                if ("url".equals(pair.getName())) {
                    queryUrl = new URL(pair.getValue());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return queryUrl;
    }
}

Related

  1. paserParams(String url)
  2. getParamValue(String url, String param)
  3. getValueFromQueryString(String url, String key)
  4. parserURIQuery(String queryText)
  5. queryComponent(String url)