Class Substitution
- java.lang.Object
-
- org.apache.catalina.valves.rewrite.Substitution
-
public class Substitution extends java.lang.ObjectRepresents a URL substitution pattern for rewrite rules. Supports back-references to rewrite rules and conditions, server variables, and map lookups.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSubstitution.MapElementSubstitution element that performs a rewrite map lookup.static classSubstitution.RewriteCondBackReferenceElementSubstitution element that produces a back-reference to a rewrite condition group.classSubstitution.RewriteRuleBackReferenceElementSubstitution element that produces a back-reference to a rewrite rule group.static classSubstitution.ServerVariableElementSubstitution element that resolves a server variable.static classSubstitution.ServerVariableEnvElementSubstitution element that resolves an environment variable.static classSubstitution.ServerVariableHttpElementSubstitution element that resolves an HTTP header variable.static classSubstitution.ServerVariableSslElementSubstitution element that resolves an SSL variable.static classSubstitution.StaticElementSubstitution element that produces a static string value.static classSubstitution.SubstitutionElementAbstract base class for individual substitution elements.
-
Field Summary
Fields Modifier and Type Field Description protected Substitution.SubstitutionElement[]elementsThe parsed substitution elements.protected static StringManagersmThe string manager for this package.protected java.lang.StringsubThe raw substitution string.
-
Constructor Summary
Constructors Constructor Description Substitution()Constructs a new Substitution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringevaluate(java.util.regex.Matcher rule, java.util.regex.Matcher cond, Resolver resolver)Evaluate the substitution based on the context.java.lang.StringgetSub()Returns the raw substitution string.voidparse(java.util.Map<java.lang.String,RewriteMap> maps)Parses the substitution string into individual elements.voidsetSub(java.lang.String sub)Sets the raw substitution string to be parsed.
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
elements
protected Substitution.SubstitutionElement[] elements
The parsed substitution elements.
-
sub
protected java.lang.String sub
The raw substitution string.
-
-
Method Detail
-
getSub
public java.lang.String getSub()
Returns the raw substitution string.- Returns:
- the substitution string
-
setSub
public void setSub(java.lang.String sub)
Sets the raw substitution string to be parsed.- Parameters:
sub- the substitution string
-
parse
public void parse(java.util.Map<java.lang.String,RewriteMap> maps)
Parses the substitution string into individual elements.- Parameters:
maps- the available rewrite maps
-
evaluate
public java.lang.String evaluate(java.util.regex.Matcher rule, java.util.regex.Matcher cond, Resolver resolver)Evaluate the substitution based on the context.- Parameters:
rule- corresponding matched rulecond- last matched conditionresolver- The property resolver- Returns:
- The substitution result
-
-