Class DnsHostMatcher
- java.lang.Object
-
- org.mapfish.print.processor.http.matcher.AbstractMatcher
-
- org.mapfish.print.processor.http.matcher.HostMatcher
-
- org.mapfish.print.processor.http.matcher.DnsHostMatcher
-
- All Implemented Interfaces:
ConfigurationObject
,URIMatcher
public class DnsHostMatcher extends HostMatcher
Allows to check that a given URL matches a DNS address (textual format). The actual comparison is performed on numerical IP addresses. The configured DNS host address is transformed into numerical IP addresses during application startup. The urls to be compared are transformed during the print processing.Example 1: Accept any www.camptocamp.com url
- !dnsMatch host: www.camptocamp.com
Example 2: Accept any www.camptocamp.com url (port == -1 accepts any port)
- !dnsMatch host: www.camptocamp.com port: -1
Example 3: Accept any www.camptocamp.com url on port 80 only
Example 4: Accept www.camptocamp.com urls with paths that start with /print/.- !dnsMatch host: www.camptocamp.com port: 80
If the regular expression give does not start with / then it will be added because all paths start with /
[[examples=http_processors]]- !dnsMatch host: www.camptocamp.com pathRegex: /print/.+
-
-
Field Summary
-
Fields inherited from class org.mapfish.print.processor.http.matcher.HostMatcher
pathRegex, port
-
-
Constructor Summary
Constructors Constructor Description DnsHostMatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
int
hashCode()
void
setHost(java.lang.String host)
Set the host.java.lang.String
toString()
java.util.Optional<java.lang.Boolean>
tryOverrideValidation(MatchInfo matchInfo)
Check the given URI to see if it matches.void
validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
validate that the configuration was correct.-
Methods inherited from class org.mapfish.print.processor.http.matcher.HostMatcher
matches, setPathRegex, setPort
-
Methods inherited from class org.mapfish.print.processor.http.matcher.AbstractMatcher
isReject, setReject
-
-
-
-
Method Detail
-
tryOverrideValidation
public final java.util.Optional<java.lang.Boolean> tryOverrideValidation(MatchInfo matchInfo) throws java.net.SocketException, java.net.UnknownHostException, java.net.MalformedURLException
Check the given URI to see if it matches.- Specified by:
tryOverrideValidation
in classHostMatcher
- Parameters:
matchInfo
- the matchInfo to validate.- Returns:
- True if it matches.
- Throws:
java.net.SocketException
java.net.UnknownHostException
java.net.MalformedURLException
-
validate
public final void validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Parameters:
validationErrors
- a list to add any detected errors to.configuration
- the containing configuration
-
setHost
public final void setHost(java.lang.String host) throws java.net.UnknownHostException
Set the host.- Parameters:
host
- the host- Throws:
java.net.UnknownHostException
-
toString
public java.lang.String toString()
- Specified by:
toString
in classHostMatcher
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classHostMatcher
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classHostMatcher
-
-