Class RedirectPatternRule


public class RedirectPatternRule extends PatternRule
Issues a (3xx) Redirect response whenever the rule finds a match.

All redirects are part of the 3xx Redirection status code set.

Defaults to 302 Found

  • Constructor Details

    • RedirectPatternRule

      public RedirectPatternRule()
    • RedirectPatternRule

      public RedirectPatternRule(@Name("pattern") String pattern, @Name("location") String location)
  • Method Details

    • setLocation

      public void setLocation(String value)
      Sets the redirect location.
      Parameters:
      value - the location to redirect.
    • setStatusCode

      public void setStatusCode(int statusCode)
      Sets the redirect status code.
      Parameters:
      statusCode - the 3xx redirect status code
    • 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 redirect status code and location.
      Overrides:
      toString in class PatternRule