Java URL Normalize normalizePrefix(String url)

Here you can find the source of normalizePrefix(String url)

Description

normalize Prefix

License

Open Source License

Declaration

public static String normalizePrefix(String url) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 National University of Ireland, Galway. All Rights Reserved.
 *
 *
 * This project is a free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * This project is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this project. If not, see <http://www.gnu.org/licenses/>.
 *******************************************************************************/

public class Main {
    public static String normalizePrefix(String url) {
        final String[] prefixes = new String[] { "http://", "https://", "ftp://", "www." };
        for (String p : prefixes) {
            if (url.startsWith(p)) {
                url = url.substring(p.length());
            }/*from   ww  w  .  j av a 2  s  .c  om*/
        }
        return url;
    }
}

Related

  1. normalize(URL u)
  2. normalize(URL url)
  3. normalize(URL url)
  4. normalizeBaseUrl(String networkUrl)
  5. normalizeCapabilitiesUrl(String url)
  6. normalizeShortUrl(String url)
  7. normalizeToLUrl(String toLUrl)
  8. normalizeToURL(String surl)
  9. NormalizeURL(final String taintedURL)