Get the domain name from this URL.
@param strDomain
@return
9402
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;
    }
1281514
public static dnssoarec get(nitro_service service, String domain) throws Exception{
		dnssoarec obj = new dnssoarec();
		obj.set_domain(domain);
		dnssoarec response = (dnssoarec) obj.get_resource(service);
		return response;
	}
2457
public String cookieDomain(String expectedCookieName) {
        Cookie cookie = cookie(expectedCookieName);
        if (cookie != null) {
            return cookie.getDomain();
        }
        return null;
    }
1105800
public String getURLMenu()
    {
        String strMenu = this.getProperty(DBParams.URL);
        if ((strMenu != null) && (strMenu.length() > 0))
        {   // Look to see if this URL has a menu associated with it.
            strMenu = Utility.getDomainFromURL(strMenu, null);
            // Now I have the domain name, try to lookup the menu name...
            Record recMenu = this.getMainRecord();
            recMenu.setKeyArea(MenusModel.CODE_KEY);
            
            try {
                while (strMenu.length() > 0)
                {
                    recMenu.getField(MenusModel.CODE).setString(strMenu);
                    if (recMenu.seek("="))
                        return recMenu.getField(MenusModel.CODE).toString();
                    if (strMenu.indexOf('.') == strMenu.lastIndexOf('.'))
                        break;  // xyz.com = stop looking
                    strMenu = strMenu.substring(strMenu.indexOf('.') + 1);  // Remove the next top level domain (ie., www)
                }
            } catch (DBException ex)    {
                ex.printStackTrace();
            }
        }
        return null;
    }
351618
public String getDomains() {
		StringWriter sw = new StringWriter();
		JsonGenerator generator;
		if (this.prettyFormat != Format.NONE) {
			JsonGeneratorFactory gf = JSONWriter.getPrettyGeneratorFactory();
			generator = gf.createGenerator(sw);
		} else
			generator = Json.createGenerator(sw);
		
		generator.writeStartArray();
		List<String> doms = DomainInformation.availableDomains(dbAccess);
		for (String dom : doms) {
			generator.write(dom);
		}
		generator.writeEnd();

		generator.flush();
		return sw.toString();
	}
1334961
public GetDomainCacheTTLResponse getDomainCacheTTL(String domain) {
        GetDomainCacheTTLRequest request = new GetDomainCacheTTLRequest().withDomain(domain);
        return getDomainCacheTTL(request);
    }
993864
public function getDomain($tldLength = 1)
    {
        $segmentList = explode('.', $this->getHost());
        $domain = array_slice($segmentList, -1 * ($tldLength + 1));
        return implode('.', $domain);
    }
875116
public function getDomain()
    {
        $model = explode("\\", $this->getModelNamespace());
        return strlen($model[0]) || 1 === count($model) ? $model[0] : $model[1];
    }
864651
public static String getDomainName(String className)
   {
	   int i = className.indexOf('.');
	   i = className.indexOf('.', i + 1);
	   if (i == -1)
		   return null;
	   return className.substring(0, i);
   }
841076
@Override
	public PDPDomain getPDPDomain(String pdpDomainName) throws IOException{
		SortedSet<String> domainRanges = null;
		if ( serializedCache != null){
			if ( serializedCache.containsKey(pdpDomainName)){
				domainRanges= serializedCache.get(pdpDomainName);

			}
		}


		boolean shouldRequestDomainRanges = checkDomainRanges(domainRanges);

		try {
			if (shouldRequestDomainRanges){
				URL u = new URL(server + "getPDPDomain?pdpId="+pdpDomainName);
				logger.info("Fetching {}",u);
				InputStream response = URLConnectionTools.getInputStream(u);
				String xml = JFatCatClient.convertStreamToString(response);
				domainRanges = XMLUtil.getDomainRangesFromXML(xml);
				if ( domainRanges != null)
					cache(pdpDomainName,domainRanges);
			}
		} catch (MalformedURLException e){
			logger.error("Problem generating PDP request URL for "+pdpDomainName,e);
			throw new IllegalArgumentException("Invalid PDP name: "+pdpDomainName, e);
		}

		String pdbId = null;
		List<ResidueRange> ranges = new ArrayList<ResidueRange>();
		for(String domainRange : domainRanges) {
			SubstructureIdentifier strucId = new SubstructureIdentifier(domainRange);
			if(pdbId == null) {
				pdbId = strucId.getPdbId();
			} else if(!pdbId.equals(strucId.getPdbId())) {
				// should never happen with correct server implementation
				throw new RuntimeException("Don't know how to take the union of domains from multiple PDB IDs.");
			}

			ranges.addAll(strucId.getResidueRanges());
		}
		return new PDPDomain(pdpDomainName,ranges);
	}
832071
public static String getDomain(HttpServletRequest request) {

		if (request == null) {
			return null;
		}

		return UrlUtils.resolveDomain(request.getServerName());
	}
701897
function GetSubdomain()
    {
        $host = $this->host;
        $sub = substr($host, 0, strlen($host) - strlen($this->GetDomain()));
        return rtrim($sub, '.');
    }
106537
@Override
	public SortedSet<String> getDomainNames(String name) {
		if ( name.length() < 4)
			throw new IllegalArgumentException("Can't interpret IDs that are shorter than 4 residues!");

		String url = String.format("%srepresentativeDomains?cluster=%s&structureId=%s",
				base, cutoff, name);
		return requestRepresentativeDomains(url);
	}
191201
static String domainOf(String url) {
    int start = -1;
    if (url.startsWith("//")) {
      start = 2;
    } else {
      start = url.indexOf("://");
      if (start >= 0) { start += 3; }
    }
    if (start < 0) { return null; }
    for (int i = 0; i < start - 3; ++i) {
      switch (url.charAt(i)) {
      case '/': case '?': case '#': return null;
      default: break;
      }
    }
    int end = url.length();
    for (int i = start; i < end; ++i) {
      switch (url.charAt(i)) {
      case '/': case '?': case '#': end = i; break;
      default: break;
      }
    }
    if (start < end) {
      return url.substring(start, end);
    } else {
      return null;
    }
  }
503265
public String getName() {
        boolean d = domain.length() > 0 && domain.equals( "?" ) == false;
        return d ? domain + "\\" + username : username;
    }
695474
public static String getRDN(String DN) {
        if (DN == null || DN.trim().length() == 0) {
            return DN;
        }
        String RDN = null;
        try {
            LdapName name = new LdapName(DN);
            if (name.size() == 0) {
                return DN;
            }
            RDN = name.get(name.size() - 1);
        } catch (InvalidNameException e) {
            e.getMessage();
            DN = DN.trim();
            int pos1 = DN.indexOf(',');
            if (DN.charAt(pos1 - 1) == '\\') {
                pos1 = DN.indexOf(pos1, ',');
            }
            if (pos1 > -1) {
                RDN = DN.substring(0, pos1).trim();
            } else {
                RDN = DN;
            }
        }
        return RDN;
    }
398174
protected function getDomain()
    {
        if ($this->domain !== null) {
            return $this->domain;
        }

        if (PHP_SAPI == 'cli') {
            $this->domain = '__CLI__';
            return $this->domain;
        }

        $this->domain = isset($_SERVER['SERVER_NAME'])? $_SERVER['SERVER_NAME'] : 'default';
        return $this->domain;
    }