Class RedirectPatternRule


public class RedirectPatternRule extends PatternRule

Issues a (3xx) redirect response whenever the rule finds a request path Servlet pattern 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

    • isTerminating

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

      public String getLocation()
    • setLocation

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

      public int getStatusCode()
    • setStatusCode

      public void setStatusCode(int statusCode)
      Set the 3xx redirect status code.
      Parameters:
      statusCode - the 3xx redirect status code
    • 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