public class RedirectRegexRule extends RegexRule
The replacement string may use $n" to replace the nth capture group.
All redirects are part of the 3xx Redirection
status code set.
Defaults to 302 Found
Rule.ApplyURI
Modifier and Type | Field | Description |
---|---|---|
protected java.lang.String |
_location |
_handling, _terminating
Constructor | Description |
---|---|
RedirectRegexRule() |
|
RedirectRegexRule(java.lang.String regex,
java.lang.String location) |
Modifier and Type | Method | Description |
---|---|---|
protected 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.
|
void |
setLocation(java.lang.String location) |
|
void |
setReplacement(java.lang.String replacement) |
Deprecated.
|
void |
setStatusCode(int statusCode) |
Sets the redirect status code.
|
java.lang.String |
toString() |
Returns the redirect status code and replacement.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRegex, matchAndApply, setRegex
isHandling, isTerminating, setHandling, setTerminating
public RedirectRegexRule()
public RedirectRegexRule(@Name("regex") java.lang.String regex, @Name("location") java.lang.String location)
@Deprecated public void setReplacement(java.lang.String replacement)
public void setLocation(java.lang.String location)
public void setStatusCode(int statusCode)
statusCode
- the 3xx redirect status codeprotected 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
RegexRule
RegexRule.matchAndApply(String, HttpServletRequest, HttpServletResponse)
if the regex matches.apply
in class RegexRule
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–2018 Webtide. All rights reserved.