Class RedirectRegexRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.RegexRule
org.eclipse.jetty.rewrite.handler.RedirectRegexRule
Issues a (3xx) redirect response whenever the rule finds a request path regular expression match
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
.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.Handler, Rule.HttpURIHandler
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Rule.Handler
apply
(Rule.Handler input, Matcher matcher) Invoked after the regular expression matched the URI path to apply the rule's logic.int
boolean
void
setLocation
(String location) Set the location to redirect.void
setStatusCode
(int statusCode) toString()
Returns the redirect status code and replacement.Methods inherited from class org.eclipse.jetty.rewrite.handler.RegexRule
getRegex, matchAndApply, setRegex
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
setTerminating
-
Field Details
-
_location
-
-
Constructor Details
-
RedirectRegexRule
public RedirectRegexRule() -
RedirectRegexRule
-
-
Method Details
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminating
in classRule
- Returns:
- whether rules after this one are not invoked
-
getLocation
-
setLocation
Set the location to redirect.- Parameters:
location
- the location to redirect.
-
getStatusCode
public int getStatusCode() -
setStatusCode
public void setStatusCode(int statusCode) -
apply
Description copied from class:RegexRule
Invoked after the regular expression matched the URI path to apply the rule's logic.
- Specified by:
apply
in classRegexRule
- Parameters:
input
- the inputRequest
andHandler
matcher
- theMatcher
that matched the request path, with capture groups available for replacement.- Returns:
- the possibly wrapped
Request
andHandler
- Throws:
IOException
- if applying the rule failed
-
toString
Returns the redirect status code and replacement.
-