If url is relative, join parent and url. Else leave url as-is.

    @return joined url
437806
def urljoin (parent, url):
    
    if urlutil.url_is_absolute(url):
        return url
    return urlparse.urljoin(parent, url)
167682
public static String mergeSlashesInUrl(String url) {
        StringBuilder builder = new StringBuilder();
        boolean prevIsColon = false;
        boolean inMerge = false;
        for (int i = 0; i < url.length(); i++) {
            char c = url.charAt(i);
            if (c == ':') {
                prevIsColon = true;
                builder.append(c);
            } else {
                if (c == '/') {
                    if (prevIsColon) {
                        builder.append(c);
                        inMerge = false;
                    } else {
                        if (!inMerge) {
                            builder.append(c);
                        }
                        inMerge = true;
                    }
                } else {
                    inMerge = false;
                    builder.append(c);
                }

                prevIsColon = false;
            }
        }

        return builder.toString();
    }
194224
def _join_url(self, base, url, admin_forwarder=False):
        
        if admin_forwarder:
            return base + url
        else:
            return urljoin(base, url)
387269
def relative(self):
        
        if not self.is_absolute():
            raise ValueError("URL should be absolute")
        val = self._val._replace(scheme="", netloc="")
        return URL(val, encoded=True)
175937
public Path getParent() {
		if (!isAbsolute())
			throw new IllegalStateException("path is not absolute: " + toString());
		if (segments.isEmpty())
			return null;
		return new Path(segments.subList(0, segments.size()-1), true);
	}
232443
def parent(self):
        
        path = self.raw_path
        if not path or path == "/":
            if self.raw_fragment or self.raw_query_string:
                return URL(self._val._replace(query="", fragment=""), encoded=True)
            return self
        parts = path.split("/")
        val = self._val._replace(path="/".join(parts[:-1]), query="", fragment="")
        return URL(val, encoded=True)
261526
protected String getNextUrl() {
		String url = urls.get(currentIndex);
		currentIndex = (currentIndex + 1) % urls.size();
		return url;
	}
251199
public static String getBaseURL(String url) {
		URL u = toURL(url);
		String base = null;
		if (u != null) {
			try {
				base = u.toURI().getScheme().concat("://").concat(u.getAuthority());
			} catch (URISyntaxException ex) {
				base = null;
			}
		}
		return base;
	}
1238549
public String buildUrl() {
    String onlineUrl = onlineRoute.getCall().request().url().toString();
    String offlineUrl = buildOfflineUrl(onlineUrl);
    return offlineUrl;
  }
750388
def build_url (self):
        
        self.build_base_url()
        if self.parent_url is not None:
            # URL joining with the parent URL only works if the query
            # of the base URL are removed first.
            # Otherwise the join function thinks the query is part of
            # the file name.
            from .urlbase import url_norm
            # norm base url - can raise UnicodeError from url.idna_encode()
            base_url, is_idn = url_norm(self.base_url, self.encoding)
            urlparts = list(urlparse.urlsplit(base_url))
            # ignore query part for filesystem urls
            urlparts[3] = ''
            self.base_url = urlutil.urlunsplit(urlparts)
        super(FileUrl, self).build_url()
        # ignore query and fragment url parts for filesystem urls
        self.urlparts[3] = self.urlparts[4] = ''
        if self.is_directory() and not self.urlparts[2].endswith('/'):
            self.add_warning(_("Added trailing slash to directory."),
                           tag=WARN_FILE_MISSING_SLASH)
            self.urlparts[2] += '/'
        self.url = urlutil.urlunsplit(self.urlparts)
633878
function joinURL (urlA, urlB) {
  urlA = urlA || "";
  urlB = urlB || "";

  let endsWithASlash = urlA.substr(-1) === "/" || urlA.substr(-1) === "\\";
  let startsWithASlash = urlB[0] === "/" || urlB[0] === "\\";

  if (endsWithASlash || startsWithASlash) {
    return urlA + urlB;
  }
  else {
    return urlA + "/" + urlB;
  }
}
656986
public Resource createRelative(String relativePath) {
        if (relativePath.startsWith("/")) {
            relativePath = relativePath.substring(1);
        }
        try {
            return new UrlResource(new URL(url, relativePath));
        } catch (MalformedURLException e) {
            return null;
        }
    }
234779
public final URL toURL(String relativeUrl) {
    try {
      URL url = toURL();
      return new URL(url, relativeUrl);
    } catch (MalformedURLException e) {
      throw new IllegalArgumentException(e);
    }
  }
1028490
public URLConnection asURLConnection() {
        URLConnection uc = getURLConnection();
        if (uc != null) return uc;
        try {
            return new InputStreamURLConnection(
                    getResourceURLOrSystemId(), 
                    this, 
                    getDefaultUrlConnectionHeader());
        } catch (Exception e) {
            throw resolvingException(e);
        }
    }
1139686
def _new_url(self, relative_url):
        """"""

        return Url(
            urljoin(self._base_url, relative_url),
            **self._default_kwargs
        )
57007
public String getUrl() {
        String frontUrl = this.url;
        if (frontUrl != null && !frontUrl.isEmpty() && !frontUrl.endsWith("/")) {
            frontUrl += '/';
        }
        return frontUrl;
    }
168727
public String url(boolean isHttps) {
		String mergedIP = ipAddress().replaceAll("\\.", "");
		char[] domainChars = mergedIP.toCharArray();
		for (int i = 0; i < domainChars.length; i++) {
			char c = domainChars[i];
			domainChars[i] = (char) (c + 97);
		}

		String domain = String.valueOf(domainChars);
		if (isHttps) {
			return "https://" + domain + ".com";
		} else {
			return "http://" + domain + ".com";
		}
	}