code: public StringBuffer getRootURL()
      {
          StringBuffer url = new StringBuffer(48);
          synchronized (url)
          {
              String scheme = getScheme();
              int port = getPort();
  
              url.append(scheme);
              url.append("://");
              if (_hostPort != null)
                  url.append(_hostPort);
              else
              {
                  url.append(getHost());
                  if (port > 0
                          && ((scheme.equalsIgnoreCase("http") && port != 80) || (scheme
                                  .equalsIgnoreCase("https") && port != 443)))
                  {
                      url.append(':');
                      url.append(port);
                  }
              }
              return url;
          }
      }
docs: Reconstructs the URL the client used to make the request. The returned URL contains a
  protocol, server name, port number, and, but it does not include a path.
  <p>
  Because this method returns a <code>StringBuffer</code>, not a string, you can modify the
  URL easily, for example, to append path and query parameters.
  
  This method is useful for creating redirect messages and for reporting errors.
  
  @return "scheme://host:port"