Class RewritePatternRule


public class RewritePatternRule extends PatternRule

A rule to rewrite the path and query that match a Servlet pattern with a fixed string.

  • Constructor Details

    • RewritePatternRule

      public RewritePatternRule()
    • RewritePatternRule

      public RewritePatternRule(@Name("pattern") String pattern, @Name("replacement") String replacement)
  • Method Details

    • setReplacement

      public void setReplacement(String replacement)

      The replacement for the path and query matched by this rule.

      Parameters:
      replacement - the replacement path
    • apply

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

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

      Specified by:
      apply in class PatternRule
      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 PatternRule