Class Rule

java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
Direct Known Subclasses:
CompactPathRule, ForceRequestHeaderValueRule, HeaderRule, InvalidURIRule, PatternRule, RegexRule, ResponseStatusHeaderRegexRule, RuleContainer

public abstract class Rule extends Object

An abstract rule that, upon matching a certain condition, may wrap the Request or the Handler to execute custom logic.

  • Constructor Details

    • Rule

      public Rule()
  • Method Details

    • matchAndApply

      public abstract Rule.Handler matchAndApply(Rule.Handler input) throws IOException

      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.

      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
    • isTerminating

      public boolean isTerminating()
      Returns:
      whether rules after this one are not invoked
    • setTerminating

      public void setTerminating(boolean value)
      Parameters:
      value - whether rules after this one are not invoked
    • toString

      public String toString()
      Overrides:
      toString in class Object