Class RuleContainer

java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.RuleContainer
All Implemented Interfaces:
Dumpable
Direct Known Subclasses:
RewriteCustomizer, VirtualHostRuleContainer

public class RuleContainer extends Rule implements Dumpable
Base container to group rules. Can be extended so that the contained rules will only be applied under certain conditions
  • Field Details

    • ORIGINAL_QUERYSTRING_ATTRIBUTE_SUFFIX

      public static final String ORIGINAL_QUERYSTRING_ATTRIBUTE_SUFFIX
      See Also:
    • _rules

      protected Rule[] _rules
    • _originalPathAttribute

      protected String _originalPathAttribute
    • _originalQueryStringAttribute

      protected String _originalQueryStringAttribute
    • _rewriteRequestURI

      protected boolean _rewriteRequestURI
    • _rewritePathInfo

      protected boolean _rewritePathInfo
  • Constructor Details

    • RuleContainer

      public RuleContainer()
  • Method Details

    • getRules

      public Rule[] getRules()
      Returns the list of rules.
      Returns:
      an array of Rule.
    • setRules

      public void setRules(Rule[] rules)
      Assigns the rules to process.
      Parameters:
      rules - an array of Rule.
    • addRule

      public void addRule(Rule rule)
      Add a Rule
      Parameters:
      rule - The rule to add to the end of the rules array
    • isRewriteRequestURI

      public boolean isRewriteRequestURI()
      Returns:
      the rewriteRequestURI If true, this handler will rewrite the value returned by HttpServletRequest.getRequestURI().
    • setRewriteRequestURI

      public void setRewriteRequestURI(boolean rewriteRequestURI)
      Parameters:
      rewriteRequestURI - true if this handler will rewrite the value returned by HttpServletRequest.getRequestURI().
    • isRewritePathInfo

      public boolean isRewritePathInfo()
      Returns:
      true if this handler will rewrite the value returned by HttpServletRequest.getPathInfo().
    • setRewritePathInfo

      public void setRewritePathInfo(boolean rewritePathInfo)
      Parameters:
      rewritePathInfo - true if this handler will rewrite the value returned by HttpServletRequest.getPathInfo().
    • getOriginalPathAttribute

      public String getOriginalPathAttribute()
      Returns:
      the originalPathAttribte. If non null, this string will be used as the attribute name to store the original request path.
    • setOriginalPathAttribute

      public void setOriginalPathAttribute(String originalPathAttribte)
      Parameters:
      originalPathAttribte - If non null, this string will be used as the attribute name to store the original request path.
    • matchAndApply

      public String matchAndApply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Process the contained rules
      Specified by:
      matchAndApply in class Rule
      Parameters:
      target - target field to pass on to the contained rules
      request - request object to pass on to the contained rules
      response - response object to pass on to the contained rules
      Returns:
      The new target if the rule has matched, else null
      Throws:
      IOException - if unable to match the rule
    • apply

      protected String apply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Process the contained rules (called by matchAndApply)
      Parameters:
      target - target field to pass on to the contained rules
      request - request object to pass on to the contained rules
      response - response object to pass on to the contained rules
      Returns:
      the target
      Throws:
      IOException - if unable to apply the rule
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Description copied from interface: Dumpable
      Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
      Specified by:
      dump in interface Dumpable
      Parameters:
      out - The appendable to dump to
      indent - The indent to apply after any new lines.
      Throws:
      IOException - if unable to write to Appendable