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") String code, @Name("message") String message)
  • Method Details

    • setCode

      public void setCode(String code)
      Sets the response status code.
      Parameters:
      code - response code
    • setMessage

      public void setMessage(String message)
      Sets the message for the Response.sendError(int, String) method. Reasons will only reflect if the code value is greater or equal to 400.
      Parameters:
      message - the reason
    • apply

      public String apply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Description copied from class: PatternRule
      Apply the rule to the request
      Specified by:
      apply in class PatternRule
      Parameters:
      target - field to attempt match
      request - request object
      response - response object
      Returns:
      The target (possible updated)
      Throws:
      IOException - exceptions dealing with operating on request or response objects
    • toString

      public String toString()
      Returns the code and reason string.
      Overrides:
      toString in class PatternRule