/** * Extracts and returns the host portion of URI string. * * This function uses java.net.URI. * * @param uriStr a string containing a URI * @return the host portion of the supplied URI, null if no host string * could be found */ static protected String hostFromUriStr(String uriStr) { debugOut("hostFromUriStr(\"" + uriStr + "\")"); String host = null; URI uri; try { uri = new URI(uriStr); host = uri.getHost(); } catch (URISyntaxException e) { debugOut(e.getMessage()); } return host; }
debugOut("domainFromHost(\"" + host + "\")"); String domain = null; Matcher mat; debugOut("domain=\"" + domain + "\""); return domain; if (TLDLookup.isThreePartTLD(tld)) { domain = mat.group(1); debugOut("domain=\"" + domain + ", tld=\"" + tld + "\""); return domain; if (TLDLookup.isTwoPartTLD(tld)) { domain = mat.group(1); debugOut("domain=\"" + domain + ", tld=\"" + tld + "\""); return domain; String tld = mat.group(2); domain = mat.group(1); debugOut("domain=\"" + domain + ", tld=\"" + tld + "\""); return domain;