Class HostMatcher
java.lang.Object
org.mapfish.print.processor.http.matcher.AbstractMatcher
org.mapfish.print.processor.http.matcher.HostMatcher
- All Implemented Interfaces:
ConfigurationObject,URIMatcher
- Direct Known Subclasses:
DnsHostMatcher,HostnameMatcher,InetHostMatcher
Used to validate the access to a map service host.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()final booleanCheck if the uri is matching.final voidsetPathRegex(String pathRegex) The regular expression used to verify the path of the uri as is expected.final voidsetPort(int port) Port of this host matcher.abstract StringtoString()tryOverrideValidation(MatchInfo matchInfo) If the subclass has its own checks or if it has a different validation method this method can return a valid value.Methods inherited from class org.mapfish.print.processor.http.matcher.AbstractMatcher
isReject, setRejectMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.mapfish.print.config.ConfigurationObject
validate
-
Field Details
-
port
protected int portThe request port. -1 is the unset/default number -
pathRegex
A regex that will be ran against the host name. If there is a match then the matcher accepts the uri.
-
-
Constructor Details
-
HostMatcher
public HostMatcher()
-
-
Method Details
-
matches
public final boolean matches(MatchInfo matchInfo) throws UnknownHostException, SocketException, MalformedURLException Description copied from interface:URIMatcherCheck if the uri is matching.- Parameters:
matchInfo- the matching information to check- Returns:
- true if the uri is matching or false otherwise
- Throws:
UnknownHostExceptionSocketExceptionMalformedURLException
-
tryOverrideValidation
protected abstract Optional<Boolean> tryOverrideValidation(MatchInfo matchInfo) throws UnknownHostException, SocketException, MalformedURLException If the subclass has its own checks or if it has a different validation method this method can return a valid value.- Parameters:
matchInfo- the match information to validate.- Throws:
UnknownHostExceptionSocketExceptionMalformedURLException
-
setPort
public final void setPort(int port) Port of this host matcher. -
setPathRegex
The regular expression used to verify the path of the uri as is expected. All paths start with /.The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
- Parameters:
pathRegex- the regular expression.
-
toString
-
hashCode
public int hashCode() -
equals
-