Java Utililty Methods URL Normalize

List of utility methods to do URL Normalize

Description

The list of methods to do URL Normalize are organized into topic(s).

Method

Stringnormalize(final String taintedURL)
normalize
return taintedURL.trim()
        .replaceAll(SPACES, DASH)
        .replaceAll(CODES, EMPTY)
        .replaceAll(SPECIAL_CHARS, EMPTY).toLowerCase();
Stringnormalize(String absoluteURL)
This method removes "."
if (absoluteURL == null) {
    return absoluteURL;
if (absoluteURL.indexOf('.') < 0) {
    return absoluteURL;
Stack tokens = new Stack();
StringTokenizer st = new StringTokenizer(absoluteURL, URL_PATH_SEP_STR, true);
...
Stringnormalize(String url)
Normalizes a given URL by applying URI#normalize() , removing trailing "/" and making sure the path part starts with "/".
String pathSeparator = "/";
URI uri = new URI(url);
uri = uri.normalize();
String path = uri.getPath();
if (!path.startsWith(pathSeparator)) {
    path = pathSeparator + path;
if (path.endsWith(pathSeparator)) {
...
Stringnormalize(String url)
normalize
if (null == url) {
    return null;
if (!url.startsWith("http://")) {
    return normalize("http://" + url);
URL u;
try {
...
Stringnormalize(String url)
normalize
return getRidOfHash(getRidOfHttps(url));
Stringnormalize(String url_str)
normalize
url_str = clean(url_str);
url_str = removewww(url_str);
url_str = translateWhiteSpaces(url_str);
return url_str;
URLnormalize(URL u)
normalize an URL,
String proto = u.getProtocol().toLowerCase();
String host = u.getHost().toLowerCase();
int port = u.getPort();
if (port != -1) {
    if (url_defport != null) {
        try {
            int udp;
            udp = ((Integer) url_defport.invoke(u, (Object[]) null)).intValue();
...
URLnormalize(URL url)
normalize
String stringUrl = url.toString();
if (!"/".equals(stringUrl.substring(stringUrl.length() - 1))) {
    stringUrl += "/";
return new URL(stringUrl);
URLnormalize(URL url)
normalize
try {
    File file = toFile(url);
    if (file != null) {
        return file.toURI().toURL();
    } else {
        return toURI(url).toURL();
} catch (MalformedURLException e) {
...
StringnormalizeBaseUrl(String networkUrl)
normalize Base Url
if (!networkUrl.endsWith("/")) {
    return networkUrl + "/";
return networkUrl;