Java Utililty Methods URL Build

List of utility methods to do URL Build

Description

The list of methods to do URL Build are organized into topic(s).

Method

StringbuildQueryString(Multimap params)
Create a query string
StringBuilder bld = new StringBuilder();
boolean afterFirst = false;
for (Map.Entry<String, String> entry : params.entries()) {
    if (afterFirst)
        bld.append("&");
    else
        afterFirst = true;
    bld.append(urlEncode(entry.getKey()));
...
StringbuildURL(int imageId)
build URL
StringBuilder builder = new StringBuilder("/");
for (int i = 1; i < 9; i++) {
    builder.append(imageId % (int) Math.pow(10, i) / (int) Math.pow(10, i - 1));
    if ((i % 2) == 0) {
        builder.append("/");
return STARS_SERVICE_PREFIX
...
StringbuildUrl(String base, String local)
build Url
int ci = local.indexOf(':');
if (local.startsWith("/") || ci == 1)
    return "file:///" + local;
if (ci > 2 && ci < 6)
    return local;
if (base == null)
    base = "file:///";
else {
...
StringbuildUrl(String cid, String lid, String sid, String pid, String qid, String imageName)
build Url
String image_server = "https://www.mousephenotype.org/images/emb/";
String url = image_server + '/' + cid + '/' + lid + '/' + sid + '/' + pid + '/' + qid + '/' + imageName;
return url;
StringbuildURL(String host, int port, String base, String ext)
build URL
StringBuilder sb = new StringBuilder();
sb.append("http://").append(host);
sb.append(":").append(port);
sb.append(base);
sb.append(ext);
return sb.toString();
StringbuildUrl(String host, String target)
Build the remote url:
http://host:8080/voxworx/target
StringBuilder s = new StringBuilder();
s.append("http://");
s.append(host);
s.append(":");
s.append(SERVICE_PORT);
s.append("/");
s.append(SERVLET_CONTEXT);
s.append("/");
...
StringbuildUrl(String protocol, String host, int port, String context)
build Url
StringBuilder url = new StringBuilder();
url.append(protocol);
url.append("://");
url.append(host);
if ("http".equals(protocol) && port == 80) {
} else if ("https".equals(protocol) && port == 443) {
} else {
    url.append(':');
...
StringbuildUrl(String scheme, String base, String path, String query)
build Url
return scheme + "://" + base + path + query;
StringbuildUrl(String scheme, String host, int port)
build Url
return scheme + "://" + host + ":" + port;
StringbuildUrl(String uri)
Builds a URL from a URI
return "http://localhost:9090" + uri;