org.apache.http.conn.util
Class PublicSuffixMatcher

java.lang.Object
  extended by org.apache.http.conn.util.PublicSuffixMatcher

@Contract(threading=SAFE)
public final class PublicSuffixMatcher
extends Object

Utility class that can test if DNS names match the content of the Public Suffix List.

An up-to-date list of suffixes can be obtained from publicsuffix.org

Since:
4.4
See Also:
PublicSuffixList

Constructor Summary
PublicSuffixMatcher(Collection<PublicSuffixList> lists)
           
PublicSuffixMatcher(Collection<String> rules, Collection<String> exceptions)
           
PublicSuffixMatcher(DomainType domainType, Collection<String> rules, Collection<String> exceptions)
           
 
Method Summary
 String getDomainRoot(String domain)
          Returns registrable part of the domain for the given domain name or null if given domain represents a public suffix.
 String getDomainRoot(String domain, DomainType expectedType)
          Returns registrable part of the domain for the given domain name or null if given domain represents a public suffix.
 boolean matches(String domain)
          Tests whether the given domain matches any of entry from the public suffix list.
 boolean matches(String domain, DomainType expectedType)
          Tests whether the given domain matches any of entry from the public suffix list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicSuffixMatcher

public PublicSuffixMatcher(Collection<String> rules,
                           Collection<String> exceptions)

PublicSuffixMatcher

public PublicSuffixMatcher(DomainType domainType,
                           Collection<String> rules,
                           Collection<String> exceptions)
Since:
4.5

PublicSuffixMatcher

public PublicSuffixMatcher(Collection<PublicSuffixList> lists)
Since:
4.5
Method Detail

getDomainRoot

public String getDomainRoot(String domain)
Returns registrable part of the domain for the given domain name or null if given domain represents a public suffix.

Parameters:
domain -
Returns:
domain root

getDomainRoot

public String getDomainRoot(String domain,
                            DomainType expectedType)
Returns registrable part of the domain for the given domain name or null if given domain represents a public suffix.

Parameters:
domain -
expectedType - expected domain type or null if any.
Returns:
domain root
Since:
4.5

matches

public boolean matches(String domain)
Tests whether the given domain matches any of entry from the public suffix list.


matches

public boolean matches(String domain,
                       DomainType expectedType)
Tests whether the given domain matches any of entry from the public suffix list.

Parameters:
domain -
expectedType - expected domain type or null if any.
Returns:
true if the given domain matches any of the public suffixes.
Since:
4.5


Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.