Java URL Normalize normalizeUrl(String baseUrl, String url)

Here you can find the source of normalizeUrl(String baseUrl, String url)

Description

normalize Url

License

Apache License

Declaration

public static String normalizeUrl(String baseUrl, String url) throws MalformedURLException 

Method Source Code

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

import java.net.MalformedURLException;

import java.net.URL;

public class Main {
    public static String normalizeUrl(String baseUrl, String url) throws MalformedURLException {
        URL parent = new URL(baseUrl);
        if (url.startsWith("?")) {
            return parent.toExternalForm().replace("?" + parent.getQuery(), "") + url;
        }//w w w . j  av  a 2s.co  m

        URL spec = new URL(parent, url);
        return spec.toExternalForm();
    }
}

Related

  1. normalizeToLUrl(String toLUrl)
  2. normalizeToURL(String surl)
  3. NormalizeURL(final String taintedURL)
  4. normalizeUrl(final String url)
  5. normalizeUrl(String baseUrl, List urlList)
  6. normalizeURL(String solrServerUrl)
  7. normalizeUrl(String url)
  8. normalizeUrl(String url)
  9. normalizeUrl(String url)