Package org.apache.http.conn.util
Class PublicSuffixMatcher
- java.lang.Object
-
- org.apache.http.conn.util.PublicSuffixMatcher
-
@Contract(threading=SAFE) public final class PublicSuffixMatcher extends java.lang.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
Constructors Constructor Description PublicSuffixMatcher(java.util.Collection<java.lang.String> rules, java.util.Collection<java.lang.String> exceptions)
PublicSuffixMatcher(java.util.Collection<PublicSuffixList> lists)
PublicSuffixMatcher(DomainType domainType, java.util.Collection<java.lang.String> rules, java.util.Collection<java.lang.String> exceptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDomainRoot(java.lang.String domain)
Returns registrable part of the domain for the given domain name ornull
if given domain represents a public suffix.java.lang.String
getDomainRoot(java.lang.String domain, DomainType expectedType)
Returns registrable part of the domain for the given domain name ornull
if given domain represents a public suffix.boolean
matches(java.lang.String domain)
Tests whether the given domain matches any of entry from the public suffix list.boolean
matches(java.lang.String domain, DomainType expectedType)
Tests whether the given domain matches any of entry from the public suffix list.
-
-
-
Constructor Detail
-
PublicSuffixMatcher
public PublicSuffixMatcher(java.util.Collection<java.lang.String> rules, java.util.Collection<java.lang.String> exceptions)
-
PublicSuffixMatcher
public PublicSuffixMatcher(DomainType domainType, java.util.Collection<java.lang.String> rules, java.util.Collection<java.lang.String> exceptions)
- Since:
- 4.5
-
PublicSuffixMatcher
public PublicSuffixMatcher(java.util.Collection<PublicSuffixList> lists)
- Since:
- 4.5
-
-
Method Detail
-
getDomainRoot
public java.lang.String getDomainRoot(java.lang.String domain)
Returns registrable part of the domain for the given domain name ornull
if given domain represents a public suffix.- Parameters:
domain
-- Returns:
- domain root
-
getDomainRoot
public java.lang.String getDomainRoot(java.lang.String domain, DomainType expectedType)
Returns registrable part of the domain for the given domain name ornull
if given domain represents a public suffix.- Parameters:
domain
-expectedType
- expected domain type ornull
if any.- Returns:
- domain root
- Since:
- 4.5
-
matches
public boolean matches(java.lang.String domain)
Tests whether the given domain matches any of entry from the public suffix list.
-
matches
public boolean matches(java.lang.String domain, DomainType expectedType)
Tests whether the given domain matches any of entry from the public suffix list.- Parameters:
domain
-expectedType
- expected domain type ornull
if any.- Returns:
true
if the given domain matches any of the public suffixes.- Since:
- 4.5
-
-