Class ResponsePatternRule


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

    • _code

      private String _code
    • _reason

      private String _reason
  • Constructor Details

    • ResponsePatternRule

      public ResponsePatternRule()
    • ResponsePatternRule

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

    • setCode

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

      public void setReason(String reason)
      Sets the reason for the response status code. Reasons will only reflect if the code value is greater or equal to 400.
      Parameters:
      reason - 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