Class RewriteCond
- java.lang.Object
-
- org.apache.catalina.valves.rewrite.RewriteCond
-
public class RewriteCond extends java.lang.ObjectRewrite condition.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRewriteCond.ConditionAbstract condition interface.static classRewriteCond.LexicalConditionLexical comparison condition.static classRewriteCond.PatternConditionPattern-based condition.static classRewriteCond.ResourceConditionResource existence condition.
-
Field Summary
Fields Modifier and Type Field Description protected RewriteCond.ConditionconditionThe condition.protected java.lang.StringcondPatternThe condition pattern.protected java.lang.StringflagsStringThe flags string.booleannocaseThis 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.booleanornextUse this to combine rule conditions with a local OR instead of the implicit AND.protected booleanpositiveWhether the condition is positive.protected SubstitutiontestThe test substitution.protected java.lang.StringtestStringThe test string.
-
Constructor Summary
Constructors Constructor Description RewriteCond()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate(java.util.regex.Matcher rule, java.util.regex.Matcher cond, Resolver resolver)Evaluate the condition based on the contextjava.lang.StringgetCondPattern()Returns the condition pattern.java.lang.StringgetFlagsString()Returns the flags string.java.util.regex.MatchergetMatcher()Returns the matcher for the condition, if it is a pattern-based condition.java.lang.StringgetTestString()Returns the test string.booleanisNocase()Returns whether the test is case-insensitive.booleanisOrnext()Returns whether to combine rule conditions with a local OR.booleanisPositive()Returns whether the condition is positive.voidparse(java.util.Map<java.lang.String,RewriteMap> maps)Parses the condition using the provided rewrite maps.voidsetCondPattern(java.lang.String condPattern)Sets the condition pattern.voidsetFlagsString(java.lang.String flagsString)Sets the flags string.voidsetNocase(boolean nocase)Sets whether the test is case-insensitive.voidsetOrnext(boolean ornext)Sets whether to combine rule conditions with a local OR.voidsetPositive(boolean positive)Sets whether the condition is positive.voidsetTestString(java.lang.String testString)Sets the test string.java.lang.StringtoString()
-
-
-
Field Detail
-
testString
protected java.lang.String testString
The test string.
-
condPattern
protected java.lang.String condPattern
The condition pattern.
-
flagsString
protected java.lang.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.
-
-
Method Detail
-
getCondPattern
public java.lang.String getCondPattern()
Returns the condition pattern.- Returns:
- the condition pattern
-
setCondPattern
public void setCondPattern(java.lang.String condPattern)
Sets the condition pattern.- Parameters:
condPattern- the condition pattern
-
getTestString
public java.lang.String getTestString()
Returns the test string.- Returns:
- the test string
-
setTestString
public void setTestString(java.lang.String testString)
Sets the test string.- Parameters:
testString- the test string
-
getFlagsString
public final java.lang.String getFlagsString()
Returns the flags string.- Returns:
- the flags string
-
setFlagsString
public final void setFlagsString(java.lang.String flagsString)
Sets the flags string.- Parameters:
flagsString- the flags string
-
parse
public void parse(java.util.Map<java.lang.String,RewriteMap> maps)
Parses the condition using the provided rewrite maps.- Parameters:
maps- the rewrite maps
-
getMatcher
public java.util.regex.Matcher getMatcher()
Returns the matcher for the condition, if it is a pattern-based condition.- Returns:
- the matcher, or
nullif not a pattern condition
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
evaluate
public boolean evaluate(java.util.regex.Matcher rule, java.util.regex.Matcher cond, Resolver resolver)Evaluate the condition based on the context- Parameters:
rule- corresponding matched rulecond- last matched conditionresolver- Property resolver- Returns:
trueif the condition matches
-
isNocase
public boolean isNocase()
Returns whether the test is case-insensitive.- Returns:
trueif case-insensitive
-
setNocase
public void setNocase(boolean nocase)
Sets whether the test is case-insensitive.- Parameters:
nocase-trueif case-insensitive
-
isOrnext
public boolean isOrnext()
Returns whether to combine rule conditions with a local OR.- Returns:
trueif OR is used
-
setOrnext
public void setOrnext(boolean ornext)
Sets whether to combine rule conditions with a local OR.- Parameters:
ornext-trueif OR is used
-
isPositive
public boolean isPositive()
Returns whether the condition is positive.- Returns:
trueif positive
-
setPositive
public void setPositive(boolean positive)
Sets whether the condition is positive.- Parameters:
positive-trueif positive
-
-