Class ResponseCookieValueRegexRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.ResponseCookieValueRegexRule
Sends a response with the configured status code whenever the value of the configured cookie matches (or does not match) a regular expression.
-
Nested Class Summary
Nested classes/interfaces inherited from class Rule
Rule.Handler, Rule.HttpURIHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()booleanisNegate()booleanmatchAndApply(Rule.Handler input) Tests whether the given inputHandler(which wraps aRequest) matches the rule, and if so returns an outputHandlerthat applies the rule logic.voidsetCode(int code) Set the http status code returned on a match.voidsetCookieName(String cookieName) Set the cookie to match onvoidsetCookieValueRegex(String cookieValueRegex) Set the regex to match against the cookie value, null to match on any valuevoidsetMessage(String message) Sets the message for the response body.voidsetNegate(boolean negate) Set whether to negate the result of the match.toString()Methods inherited from class Rule
setTerminating
-
Constructor Details
-
ResponseCookieValueRegexRule
public ResponseCookieValueRegexRule()
-
-
Method Details
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminatingin classRule- Returns:
- whether rules after this one are not invoked
-
getCookieName
-
setCookieName
Set the cookie to match on- Parameters:
cookieName- the cookie to match on
-
getCookieValueRegex
-
setCookieValueRegex
Set the regex to match against the cookie value, null to match on any value- Parameters:
cookieValueRegex- regex to match against the cookie value
-
isNegate
public boolean isNegate() -
setNegate
public void setNegate(boolean negate) Set whether to negate the result of the match.- Parameters:
negate- whether to negate the result of the match
-
getCode
public int getCode() -
setCode
public void setCode(int code) Set the http status code returned on a match.- Parameters:
code- the http status code
-
getMessage
-
setMessage
Sets the message for the response body.
- Parameters:
message- the response body message
-
matchAndApply
Description copied from class:RuleTests whether the given input
Handler(which wraps aRequest) matches the rule, and if so returns an outputHandlerthat applies the rule logic.If the input does not match,
nullis returned.- Specified by:
matchAndApplyin classRule- Parameters:
input- the inputHandlerthat wraps theRequest- Returns:
- an output
Handlerthat wraps the inputHandler, ornullif the rule does not match - Throws:
IOException- if applying the rule fails
-
toString
-