code: public static String resolveUrl(String baseUrl, String url, String defaultValue) {
  				
  		for(final String scheme : ALL_SCHEMES) {
  			if(url.startsWith(scheme)) {
  				try {
  					return UsableURIFactory.getInstance(url).getEscapedURI();
  				} catch (URIException e) {
  					LOGGER.warning(e.getLocalizedMessage() + ": " + url);
  					// can't let a space exist... send back close to whatever came
  					// in...
  					return defaultValue;
  				}
  			}
  		}
  		UsableURI absBaseURI;
  		UsableURI resolvedURI = null;
  		try {
  			absBaseURI = UsableURIFactory.getInstance(baseUrl);
  			resolvedURI = UsableURIFactory.getInstance(absBaseURI, url);
  		} catch (URIException e) {
  			LOGGER.warning(e.getLocalizedMessage() + ": " + url);
  			return defaultValue;
  		}
  		
  		return resolvedURI.getEscapedURI();
  	}
docs: Resolve a possibly relative url argument against a base URL.
  @param baseUrl the base URL against which the url should be resolved
  @param url the URL, possibly relative, to make absolute.
  @param defaultValue The default value to return if the supplied values can't be resolved.
  @return url resolved against baseUrl, unless it is absolute already, and
  further transformed by whatever escaping normally takes place with a
  UsableURI.
  In case of error, return the defaultValue