List of utility methods to do Path to URL
String | fileToURIString(File file) file To URI String return file.getAbsoluteFile().toURI().toString();
|
URI | getUri(String baseApiUrl, String path) Gets the absolute URL to use to invoke a rest API at a given path. if (baseApiUrl.endsWith("/")) { baseApiUrl = baseApiUrl.substring(0, baseApiUrl.length() - 1); if (path == null) { return new URI(baseApiUrl); } else { return new URI(baseApiUrl + path); |
String[] | getUriNormalizedContainerAndPathWithoutSlash(String stringUriValue, String containerUrl, boolean normalizeUrlMode, boolean matchBaseUrlMode) TODO replace by merely using URI to parse ! String uriBaseUrl = null; String urlPathWithoutSlash = null; if (normalizeUrlMode) { URI uriValue = new URI(stringUriValue).normalize(); if (uriValue.isAbsolute()) { if (!allowedProtocolSet.contains(uriValue.getScheme())) { throw new MalformedURLException( "Datacore URIs should be HTTP(S) but is " + uriValue.getScheme()); ... |
URL | getURL(String aPath) Returns a URL for given path. try { return getFile(aPath).toURI().toURL(); } catch (Exception e) { throw new RuntimeException(e); |
String | getUrl(String baseUrl, String absPath) get Url URI baseUri = new URI(baseUrl); URI absUri = baseUri.resolve(absPath); return absUri.toString(); |
URL | getURL(String host, int port, String path, boolean isHTTPS) get URL String myUrl = isHTTPS ? "https" : "http"; myUrl += "://" + host + ":" + port + path; return new URL(myUrl); |
URL | getUrl(String inPath) get Url return new URL(ClassLoader.getSystemResource("") + inPath); |
String | getUrl(String ip, String port, String servicePath, String serviceName, String... args) get Url StringBuilder params = new StringBuilder(); params.append("http://"); params.append(ip); params.append(":"); params.append(port); params.append(servicePath); params.append(serviceName); for (String arg : args) { ... |
URL | getURL(String path) get URL class ClassOnCurrentClassLoader { ; Object c = new ClassOnCurrentClassLoader(); return c.getClass().getResource(path); |
URL | getURL(String path) Convert a network path to a URL if (path == null) return null; try { return new URL(path); } catch (MalformedURLException e) { try { return new File(path).toURI().toURL(); } catch (MalformedURLException e2) { ... |