List of utility methods to do URL Create
URL | buildURL(String host, String path, Map build URL StringBuilder url = new StringBuilder(); url.append(host); if (!host.endsWith("/") && !path.startsWith("/")) url.append("/"); url.append(path); if (params != null && params.keySet().size() > 0) { url.append("?"); url.append(buildQueryString(params)); ... |
URL | buildURL(String id) build URL try { return new URL(TRACKER_URL_PREFIX + id); } catch (MalformedURLException e) { throw new IllegalStateException(e); |
String | buildUrl(String repositoryUrl, String resourceUrl) build Url int idx = repositoryUrl.indexOf("://"); if (idx < 0) { return repositoryUrl + resourceUrl; String protocol = repositoryUrl.substring(0, idx); protocol = normalizeProtocol(protocol); int authorityIdx = idx + 3; String authority; ... |
URL | buildURL(String spec) build URL assert (spec != null); final boolean isFile = spec.startsWith("file:"); try { if (isFile) { final File file = new File(spec.substring(5)); return adjustTrailingSlash(file.toURL(), file.isDirectory()); return new URL(spec); ... |
URL | buildURL(String spec) build URL if (spec == null) throw new NullPointerException("URL spec is null."); if (spec.startsWith("file:")) { File file = new File(spec.substring(5)); if (file.isAbsolute()) return file.toURL(); return new URL(spec); ... |
URL | buildURL(String spec, boolean trailingSlash) Builds a URL with the given specification if (spec == null) return null; boolean isFile = spec.startsWith("file:"); try { if (isFile) return adjustTrailingSlash(new File(spec.substring(5)).toURL(), trailingSlash); return new URL(spec); } catch (MalformedURLException e) { ... |
URL | buildURL(String url) Builds URL object with the specified URL string. try { return new URL(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); |
URL | buildURL(String url) Construct the URL based on the String if (url == null) throw new MalformedURLException(); url = convertBackSlashes(url); final String filename = extractFileName(url); if (filename != null) { return new File(url).toURI().toURL(); return new URL(url); ... |
URI | buildUrl(String url) Construct simple URL try { return new URI(url); } catch (URISyntaxException ex) { throw new Error("Failed to build URL", ex); |
String | buildUrl(String url, HashMap build Url StringBuilder urlString = new StringBuilder(url); if (params.isEmpty()) { return urlString.toString(); urlString.append("?"); Iterator<Entry<String, String>> it = params.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> entry = it.next(); ... |