public UrlIdentifier(String identifier, boolean removeFragment) throws DiscoveryException { _urlIdentifier = normalize(identifier, removeFragment); }
public static URL normalize(String text, boolean removeFragment) throws DiscoveryException { try { URI uri = new URI(text); URL url = uri.normalize().toURL(); String protocol = url.getProtocol().toLowerCase(); String host = url.getHost().toLowerCase(); int port = url.getPort(); String path = normalizeUrlEncoding(url.getPath()); String query = normalizeUrlEncoding(url.getQuery()); String fragment = normalizeUrlEncoding(url.getRef()); if (port == url.getDefaultPort()) port = -1; // start building the 'file' part for the URL constructor... String file = path; if ("".equals(file)) file = "/"; if (query != null) file = file + "?" + query; if (fragment != null && ! removeFragment) file = file + "#" + fragment;
public static URL normalize(String text, boolean removeFragment) throws DiscoveryException { try { URI uri = new URI(text); URL url = uri.normalize().toURL(); String protocol = url.getProtocol().toLowerCase(); String host = url.getHost().toLowerCase(); int port = url.getPort(); String path = normalizeUrlEncoding(url.getPath()); String query = normalizeUrlEncoding(url.getQuery()); String fragment = normalizeUrlEncoding(url.getRef()); if (port == url.getDefaultPort()) port = -1; // start building the 'file' part for the URL constructor... String file = path; if ("".equals(file)) file = "/"; if (query != null) file = file + "?" + query; if (fragment != null && ! removeFragment) file = file + "#" + fragment;
public UrlIdentifier(String identifier, boolean removeFragment) throws DiscoveryException { _urlIdentifier = normalize(identifier, removeFragment); }
public static URL normalize(String text, boolean removeFragment) throws DiscoveryException { try { URI uri = new URI(text); URL url = uri.normalize().toURL(); String protocol = url.getProtocol().toLowerCase(); String host = url.getHost().toLowerCase(); int port = url.getPort(); String path = normalizeUrlEncoding(url.getPath()); String query = normalizeUrlEncoding(url.getQuery()); String fragment = normalizeUrlEncoding(url.getRef()); if (port == url.getDefaultPort()) port = -1; // start building the 'file' part for the URL constructor... String file = path; if ("".equals(file)) file = "/"; if (query != null) file = file + "?" + query; if (fragment != null && ! removeFragment) file = file + "#" + fragment;
public UrlIdentifier(String identifier, boolean removeFragment) throws DiscoveryException { _urlIdentifier = normalize(identifier, removeFragment); }
public static URL normalize(String text, boolean removeFragment) throws DiscoveryException { try { URI uri = new URI(text); URL url = uri.normalize().toURL(); String protocol = url.getProtocol().toLowerCase(); String host = url.getHost().toLowerCase(); int port = url.getPort(); String path = normalizeUrlEncoding(url.getPath()); String query = normalizeUrlEncoding(url.getQuery()); String fragment = normalizeUrlEncoding(url.getRef()); if (port == url.getDefaultPort()) port = -1; // start building the 'file' part for the URL constructor... String file = path; if ("".equals(file)) file = "/"; if (query != null) file = file + "?" + query; if (fragment != null && ! removeFragment) file = file + "#" + fragment;
public UrlIdentifier(String identifier, boolean removeFragment) throws DiscoveryException { _urlIdentifier = normalize(identifier, removeFragment); }
public UrlIdentifier(String identifier, boolean removeFragment) throws DiscoveryException { _urlIdentifier = normalize(identifier, removeFragment); }
public static URL normalize(String text) throws DiscoveryException { return normalize(text, false); }