Class ResponseCookieValueRegexRule

java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.ResponseCookieValueRegexRule

public class ResponseCookieValueRegexRule extends Rule
Sends a response with the configured status code whenever the value of the configured cookie matches (or does not match) a regular expression.
  • Constructor Details

    • ResponseCookieValueRegexRule

      public ResponseCookieValueRegexRule()
  • Method Details

    • isTerminating

      public boolean isTerminating()
      Overrides:
      isTerminating in class Rule
      Returns:
      whether rules after this one are not invoked
    • getCookieName

      public String getCookieName()
    • setCookieName

      public void setCookieName(String cookieName)
      Set the cookie to match on
      Parameters:
      cookieName - the cookie to match on
    • getCookieValueRegex

      public String getCookieValueRegex()
    • setCookieValueRegex

      public void setCookieValueRegex(String cookieValueRegex)
      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

      public String getMessage()
    • setMessage

      public void setMessage(String message)

      Sets the message for the response body.

      Parameters:
      message - the response body message
    • matchAndApply

      public Rule.Handler matchAndApply(Rule.Handler input) throws IOException
      Description copied from class: Rule

      Tests whether the given input Handler (which wraps a Request) matches the rule, and if so returns an output Handler that applies the rule logic.

      If the input does not match, null is returned.

      Specified by:
      matchAndApply in class Rule
      Parameters:
      input - the input Handler that wraps the Request
      Returns:
      an output Handler that wraps the input Handler, or null if the rule does not match
      Throws:
      IOException - if applying the rule fails
    • toString

      public String toString()
      Overrides:
      toString in class Rule