Here you can find the source of normalizeUrl(URL url)
public static URL normalizeUrl(URL url) throws MalformedURLException
//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); } }