Class PatternRule

java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.PatternRule
Direct Known Subclasses:
CookiePatternRule, HeaderPatternRule, RedirectPatternRule, ResponsePatternRule, RewritePatternRule, TerminatingPatternRule

public abstract class PatternRule extends Rule

Abstract rule that uses the Servlet pattern syntax via ServletPathSpec for path pattern matching.

  • Constructor Details

    • PatternRule

      protected PatternRule()
    • PatternRule

      protected PatternRule(String pattern)
  • Method Details

    • getPattern

      public String getPattern()
    • setPattern

      public void setPattern(String pattern)
    • 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
    • apply

      protected abstract Rule.Handler apply(Rule.Handler input) throws IOException

      Invoked after the Servlet pattern matched the URI path to apply the rule's logic.

      Parameters:
      input - the input Request and Handler
      Returns:
      the possibly wrapped Request and Handler
      Throws:
      IOException - if applying the rule failed
    • toString

      public String toString()
      Overrides:
      toString in class Rule