Class RegexRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.RegexRule
- Direct Known Subclasses:
HeaderRegexRule
,RedirectRegexRule
,RewriteRegexRule
,TerminatingRegexRule
Abstract rule that uses the regular expression syntax for path pattern matching.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.Handler, Rule.HttpURIHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Rule.Handler
apply
(Rule.Handler input, Matcher matcher) Invoked after the regular expression matched the URI path to apply the rule's logic.getRegex()
Get the regular expression.matchAndApply
(Rule.Handler input) Tests whether the given inputHandler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.void
Sets the regular expression to match with the request path.toString()
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
isTerminating, setTerminating
-
Constructor Details
-
RegexRule
public RegexRule() -
RegexRule
-
-
Method Details
-
getRegex
Get the regular expression.- Returns:
- the regular expression
-
setRegex
Sets the regular expression to match with the request path.
- Parameters:
regex
- the regular expression
-
matchAndApply
Description copied from class:Rule
Tests whether the given input
Handler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.If the input does not match,
null
is returned.- Specified by:
matchAndApply
in classRule
- Parameters:
input
- the inputHandler
that wraps theRequest
- Returns:
- an output
Handler
that wraps the inputHandler
, ornull
if the rule does not match - Throws:
IOException
- if applying the rule fails
-
apply
Invoked after the regular expression matched the URI path to apply the rule's logic.
- 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
-