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

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

Introduction

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

Prototype

public boolean isPublicSuffix() 

Source Link

Document

Indicates whether this domain name represents a <i>public suffix</i>, as defined by the Mozilla Foundation's <a href="http://publicsuffix.org/">Public Suffix List</a> (PSL).

Usage

From source file:net.orpiske.mdm.broker.processors.tcs.TcsRequestConversor.java

/**
 * Gets a domain object out of data from the request
 * @param wrapper the request wrapper/* w  w  w.  j  av a2  s .c om*/
 * @return a Domain object
 */
private Domain getCspFromRequest(LoadServiceWrapper wrapper) {
    Domain csp = new Domain();

    String cspName = wrapper.getCspType().getName();
    String domain = wrapper.getCspType().getDomain();

    csp.setName(cspName);
    if (domain == null) {
        logger.warn("The requester did not inform a domain, defaulting to .csp " + " for further processing");

        csp.setDomain(cspName + INVALID_DOMAIN);
    } else {
        InternetDomainName d = InternetDomainName.from(domain);

        if (!d.isPublicSuffix()) {
            logger.warn("Input domain " + domain + " is not a public suffix");
        }

        csp.setDomain(domain);
    }
    return csp;
}