This implementation builds a URI based on the URL returned by
{@link #getURL()}.
4149
@Override
    public URI getURI() throws IOException {
        URL url = getURL();
        try {
            return ResourceUtils.toURI(url);
        } catch (URISyntaxException ex) {
            throw new RuntimeException("Invalid URI [" + url + "]", ex);
        }
    }
266889
@Override
    URI getURI() {
        try {
            return new URI(URLPathEncoder.normalizeURLPath(getZipFilePath()));
        } catch (final URISyntaxException e) {
            throw new IllegalArgumentException("Could not form URI: " + e);
        }
    }
580516
public static String getUrl(final String url) throws Exception {
        return getUrl(new URL(url), null, null);
    }
21736
protected String buildUrl(Request request)
    {
        StringBuilder sb = new StringBuilder(512);
        sb.append(baseUrl).append(request.getEntityName()).append("/");
        if(request.getPath() != null)
            sb.append(request.getPath());

        String queryString = buildQueryString(request);
        if(queryString.length()>0)
        {
            sb.append("?").append(queryString);
        }

        return sb.toString();
    }
736578
public URI build() {
		try {
			StringBuilder builder = new StringBuilder();
			Set<Entry<String, List<String>>> entrySet = parameters.entrySet();
			for (Iterator<Entry<String, List<String>>> entryIt = entrySet.iterator(); entryIt.hasNext();) {
				Entry<String, List<String>> entry = entryIt.next();
				String name = entry.getKey();
				List<String> values = entry.getValue();
				for(Iterator<String> valueIt = values.iterator(); valueIt.hasNext();) {
					String value = valueIt.next();
					builder.append(formEncode(name)).append("=");
					if(value != null) {
						builder.append(formEncode(value));
					}
					if(valueIt.hasNext()) {
						builder.append("&");
					}
				}
				if(entryIt.hasNext()) {
					builder.append("&");
				}
			}
			
			String queryDelimiter = "?";
			if(URI.create(baseUri).getQuery() != null) {
				queryDelimiter = "&";
			}
			return new URI(baseUri + (builder.length() > 0 ? queryDelimiter + builder.toString() : ""));
		} catch (URISyntaxException e) {
			throw new URIBuilderException("Unable to build URI: Bad URI syntax", e);
		}
	}
639932
private static String buildLink(final URI linkUri, final String relation) {
        return Link.fromUri(linkUri).rel(relation).build().toString();
    }
1070272
@Override
    public URI getBaseUri() {
        String basePath = config.getString(CONFIG_BASE_PATH, "/");
        if (!basePath.endsWith("/")) {
            basePath += "/";
        }
        return URI.create(basePath);
    }
806579
String buildUrl(String relativePath)
    {
        return String.format("%s://%s:%s%s%s", this.protocol, this.hostname, this.port, this.uriPrefix, relativePath);
    }
767110
def _build_url(self, shorten=True):
        """"""
        self.url = URL_FORMAT.format(*self._get_url_params(shorten=shorten))
219570
final URI spliceUrl(String resource, Map<String, String> parameters) throws RestEndpointIOException {
        try {
            URIBuilder builder;
            if (!Strings.isNullOrEmpty(baseUrl)) {
                builder = new URIBuilder(baseUrl);
                builder.setPath(builder.getPath() + resource);
            } else {
                builder = new URIBuilder(resource);
            }
            for (Entry<String, String> parameter : parameters.entrySet()) {
                builder.addParameter(parameter.getKey(), parameter.getValue());
            }
            return builder.build();
        } catch (URISyntaxException e) {
            throw new RestEndpointIOException(
                    "Unable to builder URL with base url '" + baseUrl + "' and resouce '" + resource + "'", e);
        }
    }
373312
public DataUrl build() throws NullPointerException {
        if (data == null) {
            throw new NullPointerException("data is null!");
        } else if (encoding == null) {
            throw new NullPointerException("encoding is null!");
        }
        return new DataUrl(data, encoding, mimeType, headers);
    }
236322
public URI baseURL() {
        StringBuilder b = new StringBuilder()
                .append(protocol())
                .append(host())
                .append(":")
                .append(port())
                .append("/")
                .append(versionPrefix())
                .append("/");
        try {
            return new URI(b.toString());
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Unable to construct a base URL for the API", e);
        }
    }
244503
public ApplicationResource addJsUrl(final String url) {
		if (Util.empty(url)) {
			throw new IllegalArgumentException("A URL must be provided.");
		}
		ApplicationResource res = new ApplicationResource(url);
		addJsResource(res);
		return res;
	}
1106654
public static String getHostFromURL(String url) {
		URL u = toURL(url);
		String host = (u == null) ? "" : u.getHost();
		return host;
	}
639035
public URI toURI() {
        String url = toString();
        try {
            return new URI(url);
        } catch (URISyntaxException e) {
            throw new RuntimeException("Cannot convert to URI: " + url, e);
        }
    }
1057286
public String encodeUrl() {
		// Use the URI class to properly URL encode the value.
		try {
			URI valueUri = new URI(null, null, value, null);
			return key + "=" + valueUri.toString();
		}
		catch (URISyntaxException e) {
			// This should really never happen...
			return key + "=" + "value";
		}
	}
661350
public HttpRequest buildGetRequest(GenericUrl url) throws IOException {
    return buildRequest(HttpMethods.GET, url, null);
  }