Class PublicSuffixMatcher
java.lang.Object
org.apache.hc.client5.http.psl.PublicSuffixMatcher
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, DomainType> private final Map<String, DomainType> -
Constructor Summary
ConstructorsConstructorDescriptionPublicSuffixMatcher(Collection<String> rules, Collection<String> exceptions) PublicSuffixMatcher(DomainType domainType, Collection<String> rules, Collection<String> exceptions) -
Method Summary
Modifier and TypeMethodDescriptionprivate static DomainTypefindEntry(Map<String, DomainType> map, String rule) getDomainRoot(String domain) Returns registrable part of the domain for the given domain name ornullif given domain represents a public suffix.getDomainRoot(String domain, DomainType expectedType) Returns registrable part of the domain for the given domain name ornullif given domain represents a public suffix.private static booleanmatch(DomainType domainType, DomainType expectedType) booleanTests whether the given domain matches any of the entries from the public suffix list.booleanmatches(String domain, DomainType expectedType) Tests whether the given domain matches any of entry from the public suffix list.(package private) PublicSuffixMatcher.DomainRootInforesolveDomainRoot(String domain, DomainType expectedType) booleanVerifies if the given domain does not represent a public domain root and is allowed to set cookies, have an identity represented by a certificate, etc.booleanverifyInternal(String domain)
-
Field Details
-
rules
-
exceptions
-
-
Constructor Details
-
PublicSuffixMatcher
-
PublicSuffixMatcher
public PublicSuffixMatcher(DomainType domainType, Collection<String> rules, Collection<String> exceptions) - Since:
- 4.5
-
PublicSuffixMatcher
- Since:
- 4.5
-
-
Method Details
-
findEntry
-
match
-
getDomainRoot
-
getDomainRoot
Returns registrable part of the domain for the given domain name ornullif given domain represents a public suffix.- Parameters:
domain-expectedType- expected domain type ornullif any.- Returns:
- domain root
- Since:
- 4.5
-
resolveDomainRoot
-
matches
Tests whether the given domain matches any of the entries from the public suffix list. -
matches
Tests whether the given domain matches any of entry from the public suffix list.- Parameters:
domain-expectedType- expected domain type ornullif any.- Returns:
trueif the given domain matches any of the public suffixes.- Since:
- 4.5
-
verify
Verifies if the given domain does not represent a public domain root and is allowed to set cookies, have an identity represented by a certificate, etc.This method tolerates a leading dot in the domain name, for example '.example.com' which will be automatically stripped.
- Since:
- 5.5
-
verifyInternal
-