tds/src/main/java/thredds/server/config/HtmlConfigBean.java
public String prepareUrlStringForHtml(String url) {
    if (url == null)
      return null;
    URI uri;
    try {
      uri = new URI(url);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Given a bad URL [" + url + "].", e);
    }
    if (uri.isAbsolute())
      return uri.toString();
    if (url.startsWith("/"))
      return url;
    return this.getWebappContextPath() + "/" + url;
  }
public String prepareUrlStringForHtml(String url) {
    if (url == null)
      return null;
    URI uri;
    try {
      uri = new URI(url);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Given a bad URL [" + url + "].", e);
    }
    if (uri.isAbsolute())
      return uri.toString();
    if (url.startsWith("/"))
      return url;
    return this.getWebappContextPath() + "/" + url;
  }
Return a URL ready to use in a generated HTML page from a URL that
is either absolute or relative to the webapp context path. That is,
if relative, it is relative to "http://server:port/thredds/".
<p/>
<p>For simplicity, all relative URLs are converted to URLs that are
absolute paths. For instance, "catalog.xml" becomes "/thredds/catalog.xml".

@param url the URL to prepare for use in HTML.
@return a URL ready to use in a generated HTML page.