List of utility methods to do URL Sanitize
String | sanitizeCollabNetUrl(String url) Sanitizes a CollabNet url and make it appropriate to be used by this plugin. if (url != null && url.endsWith("/")) { url = url.substring(0, url.length() - 1); return url; |
String | sanitizeDefaultPort(String url) Removes the port from a URL if this port is the default one for the URL's scheme. int afterSchemeIndex = url.indexOf("://"); if (afterSchemeIndex < 0) { return url; String scheme = url.substring(0, afterSchemeIndex); int fromIndex = scheme.length() + 3; int ipv6StartIndex = url.indexOf('[', fromIndex); if (ipv6StartIndex > 0) { ... |
String | sanitizeForNextUrl(String url) Sanitizes the given URL for the parameter Const.ParamsNames#NEXT_URL . if (url == null) { return null; return url.replace("&", "${amp}").replace("%2B", "${plus}").replace("%23", "${hash}"); |
String | sanitizeUri(String uri) sanitize Uri if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); return uri.replaceAll("//", "/"); |
String | sanitizeUri(String uri) Sanitizes a URI. if (isSafeUri(uri)) { return uri; } else { return "#"; |
String | sanitizeURL(String url) sanitize URL try { if (url.substring(0, 7).toLowerCase().equals("http://")) { url = url.substring(7); } else if (url.substring(0, 8).toLowerCase().equals("https://")) { url = url.substring(8); } else if (url.charAt(url.length() - 1) == '/') { url = url.substring(0, url.length() - 1); } catch (Exception ex) { throw new Exception(ex.getMessage(), ex); return url; |
String | sanitizeUrl(String url) This method attempts to remove any username and password from the given url String. if (url == null) return null; return url.replaceAll("(?<=//).*:.*@", "") + "\"]"; |
String | sanitizeUrl(String url) sanitize Url return url.replaceAll("\\\\", "/"); |
String | sanitizeURL(String url) Attaches the "/" at end of given url. if (!url.endsWith("/")) { url = url + "/"; return url; |
String | sanitizeUrlWithoutProtocol(String url, String protocol) Sanitizes a given URL to NOT include a protocol prefix. int i = url.indexOf("://"); if (i >= 0 && url.indexOf('/') - 1 == i) { if (!url.substring(0, i).equals(protocol)) { throw new IllegalArgumentException( "Invalid URL: Uses protocol " + url.substring(0, i) + ", but " + protocol + " required"); return url.substring(i + 3); return url; |