Example usage for com.google.common.net InternetDomainName equals

List of usage examples for com.google.common.net InternetDomainName equals

Introduction

In this page you can find the example usage for com.google.common.net InternetDomainName equals.

Prototype

@Override
public boolean equals(@Nullable Object object) 

Source Link

Document

Equality testing is based on the text supplied by the caller, after normalization as described in the class documentation.

Usage

From source file:org.archive.crawler.prefetch.HostQuotaEnforcer.java

@Override
protected boolean shouldProcess(CrawlURI curi) {
    String uriHostname = serverCache.getHostFor(curi.getUURI()).getHostName();
    if (getApplyToSubdomains() && InternetDomainName.isValid(host) && InternetDomainName.isValid(uriHostname)) {
        InternetDomainName h = InternetDomainName.from(host);
        InternetDomainName uriHostOrAncestor = InternetDomainName.from(uriHostname);
        while (true) {
            if (uriHostOrAncestor.equals(h)) {
                return true;
            }//w w  w  .  j  ava  2s  .c o  m
            if (uriHostOrAncestor.hasParent()) {
                uriHostOrAncestor = uriHostOrAncestor.parent();
            } else {
                break;
            }
        }

        return false;
    } else {
        return serverCache.getHostFor(curi.getUURI()) == serverCache.getHostFor(host);
    }

}

From source file:org.fineract.module.stellar.federation.LocalFederationService.java

public boolean handlesDomain(final InternetDomainName domain) {
    final InternetDomainName federationDomainName;
    try {/*from   w ww. j  a v  a  2  s  .  c o m*/
        federationDomainName = InternetDomainName.from(federationDomain);
    } catch (final IllegalArgumentException e) {
        return false; //If we are not configured with a valid domain name, we don't handle this one.
    }

    return domain.equals(federationDomainName);
}