# Class RewriteCond

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

public class RewriteCond extends Object
Rewrite condition.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`RewriteCond.Condition`
Abstract condition interface.
`static class`
`RewriteCond.LexicalCondition`
Lexical comparison condition.
`static class`
`RewriteCond.PatternCondition`
Pattern-based condition.
`static class`
`RewriteCond.ResourceCondition`
Resource existence condition.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected RewriteCond.Condition`
`condition`
The condition.
`protected String`
`condPattern`
The condition pattern.
`protected String`
`flagsString`
The flags string.
`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.
`boolean`
`ornext`
Use this to combine rule conditions with a local OR instead of the implicit AND.
`protected boolean`
`positive`
Whether the condition is positive.
`protected Substitution`
`test`
The test substitution.
`protected String`
`testString`
The test string.

## Constructor Summary

Constructors
Constructor
Description
`RewriteCond()`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`evaluate(Matcher rule, Matcher cond, Resolver resolver)`
Evaluate the condition based on the context
`String`
`getCondPattern()`
Returns the condition pattern.
`final String`
`getFlagsString()`
Returns the flags string.
`Matcher`
`getMatcher()`
Returns the matcher for the condition, if it is a pattern-based condition.
`String`
`getTestString()`
Returns the test string.
`boolean`
`isNocase()`
Returns whether the test is case-insensitive.
`boolean`
`isOrnext()`
Returns whether to combine rule conditions with a local OR.
`boolean`
`isPositive()`
Returns whether the condition is positive.
`void`
`parse(Map<String, RewriteMap> maps)`
Parses the condition using the provided rewrite maps.
`void`
`setCondPattern(String condPattern)`
Sets the condition pattern.
`final void`
`setFlagsString(String flagsString)`
Sets the flags string.
`void`
`setNocase(boolean nocase)`
Sets whether the test is case-insensitive.
`void`
`setOrnext(boolean ornext)`
Sets whether to combine rule conditions with a local OR.
`void`
`setPositive(boolean positive)`
Sets whether the condition is positive.
`void`
`setTestString(String testString)`
Sets the test string.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## 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