Top Description Fields Constructors Methods
org.apache.http.conn.util

public final Class PublicSuffixMatcher

extends Object
Class Inheritance
Annotations
@Contract
threading:SAFE
Imports
java.net.IDN, java.util.Collection, .List, .Map, java.util.concurrent.ConcurrentHashMap, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.util.Args

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
org.apache.http.conn.util.PublicSuffixList

Field Summary

Modifier and TypeField and Description
private final Map<String, DomainType>
private final Map<String, DomainType>

Constructor Summary

AccessConstructor and Description
public
PublicSuffixMatcher(final Collection<String> rules, final Collection<String> exceptions)

public
PublicSuffixMatcher(final DomainType domainType, final Collection<String> rules, final Collection<String> exceptions)

public

Method Summary

Modifier and TypeMethod and Description
private static DomainType
findEntry(final Map<String, DomainType> map, final String rule)

public String

Returns:

domain root
getDomainRoot
(final String domain)

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

public String

Returns:

domain root
getDomainRoot
(final String domain, final DomainType
expected domain type or null if any.
expectedType
)

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

private static boolean
match(final DomainType domainType, final DomainType expectedType)

public boolean
matches(final String domain)

Tests whether the given domain matches any of entry from the public suffix list.

public boolean

Returns:

true if the given domain matches any of the public suffixes.
matches
(final String domain, final DomainType
expected domain type or null if any.
expectedType
)

Tests whether the given domain matches any of entry from the public suffix list.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exceptionsback to summary
private final Map<String, DomainType> exceptions
rulesback to summary
private final Map<String, DomainType> rules

Constructor Detail

PublicSuffixMatcherback to summary
public PublicSuffixMatcher(final Collection<String> rules, final Collection<String> exceptions)
PublicSuffixMatcherback to summary
public PublicSuffixMatcher(final DomainType domainType, final Collection<String> rules, final Collection<String> exceptions)
Since
4.5
PublicSuffixMatcherback to summary
public PublicSuffixMatcher(final Collection<PublicSuffixList> lists)
Since
4.5

Method Detail

findEntryback to summary
private static DomainType findEntry(final Map<String, DomainType> map, final String rule)
getDomainRootback to summary
public String getDomainRoot(final String domain)

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

Returns:String

domain root

getDomainRootback to summary
public String getDomainRoot(final String domain, final DomainType expectedType)

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

Parameters
expectedType:DomainType

expected domain type or null if any.

Returns:String

domain root

Since
4.5
matchback to summary
private static boolean match(final DomainType domainType, final DomainType expectedType)
matchesback to summary
public boolean matches(final String domain)

Tests whether the given domain matches any of entry from the public suffix list.

matchesback to summary
public boolean matches(final String domain, final DomainType expectedType)

Tests whether the given domain matches any of entry from the public suffix list.

Parameters
expectedType:DomainType

expected domain type or null if any.

Returns:boolean

true if the given domain matches any of the public suffixes.

Since
4.5