List of utility methods to do URL Normalize
String | normalizeCapabilitiesUrl(String url) normalize Capabilities Url URL inUrl = new URL(url); URL ret = new URL(inUrl.getProtocol(), inUrl.getHost(), inUrl.getPort(), inUrl.getFile()); return ret.toExternalForm(); |
String | normalizePrefix(String url) normalize Prefix final String[] prefixes = new String[] { "http://", "https://", "ftp://", "www." }; for (String p : prefixes) { if (url.startsWith(p)) { url = url.substring(p.length()); return url; |
String | normalizeShortUrl(String url) normalize Short Url url = url.toLowerCase(); url = url.replaceAll("^(^(http|https)://)|www.", ""); url = url.replaceAll("//", ""); int endIndex = url.lastIndexOf("/"); if (endIndex == (url.length() - 1)) { url = url.substring(0, endIndex); return url; ... |
String | normalizeToLUrl(String toLUrl) normalize To L Url String res = toLUrl.replace("http", "https"); res = res.replace("//treasuryoflives.org", "//www.treasuryoflives.org"); res = res.replace("//beta.treasuryoflives.org", "//www.treasuryoflives.org"); return res; |
URL | normalizeToURL(String surl) normalize To URL if (surl == null) return null; try { return new URL(surl); } catch (MalformedURLException e) { if (surl.indexOf(' ') > 0) { try { return new URL(surl.replaceAll("\\s", "%20")); ... |
String | NormalizeURL(final String taintedURL) Normalization code courtesy of 'Mike Houston' http://stackoverflow.com/questions/2993649/how-to-normalize-a-url-in-java final URL url; try { url = new URI(taintedURL).normalize().toURL(); } catch (URISyntaxException e) { throw new MalformedURLException(e.getMessage()); final String path = url.getPath().replace("/$", ""); final SortedMap<String, String> params = CreateParameterMap(url.getQuery()); ... |
String | normalizeUrl(final String url) Returns normalized url path. try { return new URI(url).normalize().toASCIIString(); } catch (final URISyntaxException e) { return url; |
List | normalizeUrl(String baseUrl, List normalize Url List<String> newUrlList = new ArrayList<>(); for (String url : urlList) { newUrlList.add(normalizeUrl(baseUrl, url)); return newUrlList; |
String | normalizeUrl(String baseUrl, String url) normalize Url URL parent = new URL(baseUrl); if (url.startsWith("?")) { return parent.toExternalForm().replace("?" + parent.getQuery(), "") + url; URL spec = new URL(parent, url); return spec.toExternalForm(); |
String | normalizeURL(String solrServerUrl) normalize URL String serverUrl = solrServerUrl; if (serverUrl.endsWith("/")) { serverUrl = serverUrl.substring(0, serverUrl.length() - 1); return serverUrl; |