public String getDomain() {
        if (parsedDomain) {
            return domain;
        }
        String host = getHost();
        if (host == null) return null;

        int firstDotPos = host.indexOf(".");
        int lastDotPos = host.lastIndexOf(".");

        String domain;
        if (firstDotPos < 0) {
            // "." was not found at all
            domain = host;
        } else if (firstDotPos == lastDotPos) {
            //there is only one "." in the host
            domain = host;
        } else {
            //for www.host.com return host.com
            //TODO: Must be corrected when implementing tldlist
            domain = host.substring(firstDotPos + 1, host.length());
        }

        this.parsedDomain = true;
        this.domain = domain;
        return domain;
    }
Returns the <i>rest</i> of this uri, that is what is following the host or port.
This is path, query and fragment as defined in RFC 2396. Returns an empty string
if this uri has no rest.
vespajlib/src/main/java/com/yahoo/net/URI.java