Java URL Normalize normalize(final String taintedURL)

Here you can find the source of normalize(final String taintedURL)

Description

normalize

License

Apache License

Declaration

public static String normalize(final String taintedURL) 

Method Source Code

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

public class Main {
    private static final String SPACES = " ";
    private static final String CODES = "%([abcdef]|\\d){2,2}";
    private static final String SPECIAL_CHARS = "[\\/?!:\\[\\]`.,()*\"';{}+=<>~\\$|#]";
    private static final String DASH = "-";
    private static final String EMPTY = "";

    public static String normalize(final String taintedURL) {
        return taintedURL.trim()

                .replaceAll(SPACES, DASH)

                .replaceAll(CODES, EMPTY)

                .replaceAll(SPECIAL_CHARS, EMPTY).toLowerCase();
    }//  ww w  . j a  va 2s  . com
}

Related

  1. normalize(String absoluteURL)
  2. normalize(String url)
  3. normalize(String url)
  4. normalize(String url)