Class ResponsePatternRule


public class ResponsePatternRule extends PatternRule
Sends the response code whenever the rule finds a match.
  • Constructor Details

    • ResponsePatternRule

      public ResponsePatternRule()
    • ResponsePatternRule

      public ResponsePatternRule(@Name("pattern") String pattern, @Name("code") int code, @Name("message") String message)
  • Method Details

    • isTerminating

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

      public int getCode()
    • setCode

      public void setCode(int code)
      Set the response code.
      Parameters:
      code - the response code
    • getMessage

      public String getMessage()
    • setMessage

      public void setMessage(String message)

      Sets the message for the response body (if the response code may have a body).

      Parameters:
      message - the response message
    • 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