Class HeaderRegexRule


public class HeaderRegexRule extends RegexRule

Puts or adds a response header whenever the rule matches a path regex pattern.

  • Constructor Details

    • HeaderRegexRule

      public HeaderRegexRule()
    • HeaderRegexRule

      public HeaderRegexRule(@Name("regex") String regex, @Name("name") String name, @Name("value") String value)
  • Method Details

    • getHeaderName

      public String getHeaderName()
    • setHeaderName

      public void setHeaderName(String name)
    • getHeaderValue

      public String getHeaderValue()
    • setHeaderValue

      public void setHeaderValue(String value)
    • isAdd

      public boolean isAdd()
    • setAdd

      public void setAdd(boolean add)
      Set true to add the response header, false to put the response header..
      Parameters:
      add - true to add the response header, false to put the response header.
    • apply

      protected Rule.Handler apply(Rule.Handler input, Matcher matcher) throws IOException
      Description copied from class: RegexRule

      Invoked after the regular expression matched the URI path to apply the rule's logic.

      Specified by:
      apply in class RegexRule
      Parameters:
      input - the input Request and Handler
      matcher - the Matcher that matched the request path, with capture groups available for replacement.
      Returns:
      the possibly wrapped Request and Handler
      Throws:
      IOException - if applying the rule failed
    • toString

      public String toString()
      Overrides:
      toString in class RegexRule