Java URL Normalize normalizeUrl(URL url)

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

Description

normalize Url

License

Open Source License

Declaration

public static URL normalizeUrl(URL url) throws MalformedURLException 

Method Source Code

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

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    public static URL normalizeUrl(URL url) throws MalformedURLException {
        if (url == null)
            return (null);

        String urlStr = url.toString();

        // TODO: handle lack of "www."?
        //if (urlStr.startsWith("http://")) {
        //   if (urlStr.substring())
        //}/*  w  w w. j a  v a  2 s . com*/
        if (urlStr.endsWith("/")) {
            return (new URL(urlStr.substring(0, urlStr.length() - 1)));
        }
        return (url);
    }
}

Related

  1. normalizeURL(URL codebase)
  2. normalizeUrl(URL url)
  3. normalizeUrl(URL url)
  4. normalizeURL(URL url)
  5. normalizeUrl(URL url)
  6. normalizeURL(URL url)
  7. normalizeUrlStr(String urlStr)