docs: public static String getDomainFromURL(String strURL, String strContextPathAtEnd, boolean includePortNumber)
      {
          String strDomain = strURL;
          
          if (strDomain.indexOf(':') < 8)
              strDomain = strDomain.substring(strDomain.indexOf(':') + 1);  // Get rid of protocol
          if (strDomain.indexOf("//") == 0)
              strDomain = strDomain.substring(2);  // Get rid of '//'
          if (strDomain.indexOf('?') != -1)
              strDomain = strDomain.substring(0, strDomain.indexOf('?'));   // Get rid of params
          int iEndDomain = strDomain.indexOf('/');
          if (iEndDomain == -1)
              iEndDomain = strDomain.length();
          if (strDomain.lastIndexOf(Constants.DEFAULT_SERVLET) >= iEndDomain)
              strDomain = strDomain.substring(0, strDomain.lastIndexOf(Constants.DEFAULT_SERVLET) - 1);   // Strip servlet name
          if ((strDomain.indexOf(':') != -1) && (includePortNumber == false))
              strDomain = strDomain.substring(0, strDomain.indexOf(':'));  // Get rid of port number
          else
              strDomain = strDomain.substring(0, iEndDomain);
          
          if (strContextPathAtEnd != null)
          {
              int iStartIndex = strURL.indexOf(strDomain);
              int iContextIndex = strURL.indexOf(strContextPathAtEnd, iStartIndex + strDomain.length());
              if (iContextIndex != -1)
              {   // Always
                  iContextIndex = iContextIndex + strContextPathAtEnd.length();
                  strDomain = strURL.substring(iStartIndex, iContextIndex);
                  if (!strDomain.endsWith(System.getProperty("file.separator")))
                      strDomain = strDomain + System.getProperty("file.separator");
              }
          }
          return strDomain;
      }