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 and Description |
---|---|
protected String |
_location |
_handling, _terminating
Constructor and Description |
---|
RedirectRegexRule() |
RedirectRegexRule(String regex,
String location) |
Modifier and Type | Method and Description |
---|---|
protected String |
apply(String target,
HttpServletRequest request,
HttpServletResponse response,
Matcher matcher)
Apply this rule to the request/response pair.
|
void |
setLocation(String location) |
void |
setReplacement(String replacement)
Deprecated.
|
void |
setStatusCode(int statusCode)
Sets the redirect status code.
|
String |
toString()
Returns the redirect status code and replacement.
|
getRegex, matchAndApply, setRegex
isHandling, isTerminating, setHandling, setTerminating
protected String _location
@Deprecated public void setReplacement(String replacement)
public void setLocation(String location)
public void setStatusCode(int statusCode)
statusCode
- the 3xx redirect status codeprotected String apply(String target, HttpServletRequest request, HttpServletResponse response, Matcher matcher) throws 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).IOException
- exceptions dealing with operating on request or response objectsCopyright © 1995–2017 Webtide. All rights reserved.