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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Rule.Handlerapply(Rule.Handler input, Matcher matcher) Invoked after the regular expression matched the URI path to apply the rule's logic.intbooleanvoidsetLocation(String location) voidsetStatusCode(int statusCode) toString()Returns the redirect status code and replacement.Methods inherited from class org.eclipse.jetty.rewrite.handler.RegexRule
getRegex, matchAndApply, setRegexMethods 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:
isTerminatingin classRule- Returns:
- when
true, rules after this one are not invoked
-
getLocation
-
setLocation
- Parameters:
location- the location to redirect.
-
getStatusCode
public int getStatusCode() -
setStatusCode
public void setStatusCode(int statusCode) -
apply
Description copied from class:RegexRuleInvoked after the regular expression matched the URI path to apply the rule's logic.
- Specified by:
applyin classRegexRule- Parameters:
input- the inputRequestandHandlermatcher- theMatcherthat matched the request path, with capture groups available for replacement.- Returns:
- the possibly wrapped
RequestandHandler - Throws:
IOException- if applying the rule failed
-
toString
Returns the redirect status code and replacement.
-