Class RewriteCond

java.lang.Object
org.apache.catalina.valves.rewrite.RewriteCond

public class RewriteCond extends Object
Rewrite condition.
  • Field Details

    • testString

      protected String testString
      The test string.
    • condPattern

      protected String condPattern
      The condition pattern.
    • flagsString

      protected String flagsString
      The flags string.
    • positive

      protected boolean positive
      Whether the condition is positive.
    • test

      protected Substitution test
      The test substitution.
    • condition

      protected RewriteCond.Condition condition
      The condition.
    • nocase

      public boolean nocase
      This makes the test case-insensitive, i.e., there is no difference between 'A-Z' and 'a-z' both in the expanded TestString and the CondPattern. This flag is effective only for comparisons between TestString and CondPattern. It has no effect on filesystem and subrequest checks.
    • ornext

      public boolean ornext
      Use this to combine rule conditions with a local OR instead of the implicit AND.
  • Constructor Details

    • RewriteCond

      public RewriteCond()
      Default constructor.
  • Method Details

    • getCondPattern

      public String getCondPattern()
      Returns the condition pattern.
      Returns:
      the condition pattern
    • setCondPattern

      public void setCondPattern(String condPattern)
      Sets the condition pattern.
      Parameters:
      condPattern - the condition pattern
    • getTestString

      public String getTestString()
      Returns the test string.
      Returns:
      the test string
    • setTestString

      public void setTestString(String testString)
      Sets the test string.
      Parameters:
      testString - the test string
    • getFlagsString

      public final String getFlagsString()
      Returns the flags string.
      Returns:
      the flags string
    • setFlagsString

      public final void setFlagsString(String flagsString)
      Sets the flags string.
      Parameters:
      flagsString - the flags string
    • parse

      public void parse(Map<String, RewriteMap> maps)
      Parses the condition using the provided rewrite maps.
      Parameters:
      maps - the rewrite maps
    • getMatcher

      public Matcher getMatcher()
      Returns the matcher for the condition, if it is a pattern-based condition.
      Returns:
      the matcher, or null if not a pattern condition
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • evaluate

      public boolean evaluate(Matcher rule, Matcher cond, Resolver resolver)
      Evaluate the condition based on the context
      Parameters:
      rule - corresponding matched rule
      cond - last matched condition
      resolver - Property resolver
      Returns:
      true if the condition matches
    • isNocase

      public boolean isNocase()
      Returns whether the test is case-insensitive.
      Returns:
      true if case-insensitive
    • setNocase

      public void setNocase(boolean nocase)
      Sets whether the test is case-insensitive.
      Parameters:
      nocase - true if case-insensitive
    • isOrnext

      public boolean isOrnext()
      Returns whether to combine rule conditions with a local OR.
      Returns:
      true if OR is used
    • setOrnext

      public void setOrnext(boolean ornext)
      Sets whether to combine rule conditions with a local OR.
      Parameters:
      ornext - true if OR is used
    • isPositive

      public boolean isPositive()
      Returns whether the condition is positive.
      Returns:
      true if positive
    • setPositive

      public void setPositive(boolean positive)
      Sets whether the condition is positive.
      Parameters:
      positive - true if positive