public abstract class RegexRule extends Rule
Rule.ApplyURI
Modifier and Type | Field and Description |
---|---|
protected java.util.regex.Pattern |
_regex |
_handling, _terminating
Modifier | Constructor and Description |
---|---|
protected |
RegexRule() |
protected |
RegexRule(java.lang.String pattern) |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
apply(java.lang.String target,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.regex.Matcher matcher)
Apply this rule to the request/response pair.
|
java.lang.String |
getRegex() |
java.lang.String |
matchAndApply(java.lang.String target,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method calls tests the rule against the request/response pair and if the Rule
applies, then the rule's action is triggered.
|
void |
setRegex(java.lang.String regex)
Sets the regular expression string used to match with string URI.
|
java.lang.String |
toString()
Returns the regular expression string.
|
isHandling, isTerminating, setHandling, setTerminating
protected RegexRule()
protected RegexRule(java.lang.String pattern)
public void setRegex(java.lang.String regex)
regex
- the regular expression.public java.lang.String getRegex()
public java.lang.String matchAndApply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
Rule
matchAndApply
in class Rule
target
- The target of the requestrequest
- the requestresponse
- the responsejava.io.IOException
- if unable to match the ruleprotected abstract java.lang.String apply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.regex.Matcher matcher) throws java.io.IOException
matchAndApply(String, HttpServletRequest, HttpServletResponse)
if the regex matches.target
- field to attempt matchrequest
- request objectresponse
- response objectmatcher
- The Regex matcher that matched the request (with capture groups available for replacement).java.io.IOException
- exceptions dealing with operating on request or response objectsCopyright © 1995–2023 Webtide. All rights reserved.