Java Utililty Methods URI Create

List of utility methods to do URI Create

Description

The list of methods to do URI Create are organized into topic(s).

Method

voidaddParameter(String name, String value, StringBuilder uri)
add Parameter
if (uri.length() > 0)
    uri.append('&');
uri.append(encode(name));
if (value != null) {
    uri.append('=');
    uri.append(encode(value));
voidaddParameters(Map parameters, StringBuilder uri)
Add parameters to the uri.
if (parameters == null || parameters.isEmpty())
    return;
for (Entry<String, String> param : parameters.entrySet())
    addParameter(param.getKey(), param.getValue(), uri);
voidaddParams(final Map params, final StringBuilder uri)
add Params
if (params == null || params.isEmpty())
    return;
for (Map.Entry<String, String> param : params.entrySet())
    addParam(param.getKey(), param.getValue(), uri);
URIaddParams(URI uri, Map> params, Set overridenParams)
Add the given params to the query
if (params == null || params.size() == 0) {
    return uri;
final String origTxt = uri.toString();
int queryStart = origTxt.indexOf('?');
final StringBuilder result = new StringBuilder();
if (queryStart < 0) {
    int fragmentStart = origTxt.indexOf('#');
...
URIaddQueryParametersToUri(URI uri, Map parameters)
add Query Parameters To Uri
StringBuilder urlParametersBuilder = new StringBuilder();
if (uri == null) {
    throw new IllegalArgumentException("Define URL before URL parameters");
urlParametersBuilder.append(uri.toString());
String concatenator = FIRST_PARAMETER_CONCATENATOR;
for (String paramName : parameters.keySet()) {
    validateParameters(paramName);
...
StringaddQueryParamsToUri(String uri, Map queryParams)
add Query Params To Uri
if (queryParams.size() == 0) {
    return uri;
StringBuilder query = new StringBuilder();
for (Map.Entry<String, String> params : queryParams.entrySet()) {
    try {
        if (query.length() > 0) {
            query.append("&");
...
URIaddQueryString(final URI uri, final String queryString)
add Query String
if (queryString == null) {
    return uri;
if (uri == null) {
    return null;
return uri.resolve(uri.toString() + queryString);
URIconvertToURI(String uriOrPath)
Converts a string representing a file or uri to a uri object.
if (uriOrPath.contains("://")) {
    return URI.create(uriOrPath);
} else {
    return new File(uriOrPath).toURI();
URIconvertToURI(String uriString, Map aliasMap)
Replace an alias in a URI, if one is recognized.
try {
    URI uri = new URI(uriString);
    if (uri.isOpaque()) {
        URI mapping = aliasMap.get(uri.getScheme());
        if (mapping != null) {
            uri = new URI(mapping.toString() + uri.getSchemeSpecificPart()
                    + (uri.getFragment() != null ? "#" + uri.getFragment() : ""));
    return uri;
} catch (URISyntaxException e) {
    throw new RuntimeException("Bad URI syntax in resource", e);
URIconvertToURI(String value)
convert To URI
try {
    return value == null ? null : new URI(value);
} catch (URISyntaxException exc) {
    return null;