Substitution (Apache Tomcat 11.0.22 API Documentation)
Description: declaration: package: org.apache.catalina.valves.rewrite, class: Substitution

# Class Substitution

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

public class Substitution extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `Substitution.MapElement`
  `static class`
  `Substitution.RewriteCondBackReferenceElement`
  `class`
  `Substitution.RewriteRuleBackReferenceElement`
  `static class`
  `Substitution.ServerVariableElement`
  `static class`
  `Substitution.ServerVariableEnvElement`
  `static class`
  `Substitution.ServerVariableHttpElement`
  `static class`
  `Substitution.ServerVariableSslElement`
  `static class`
  `Substitution.StaticElement`
  `static class`
  `Substitution.SubstitutionElement`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Substitution.SubstitutionElement[]`
  `elements`
  `protected static final StringManager`
  `sm`
  `protected String`
  `sub`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Substitution()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `evaluate(Matcher rule, Matcher cond, Resolver resolver)`
  Evaluate the substitution based on the context.
  `String`
  `getSub()`
  `void`
  `parse(Map<String, RewriteMap> maps)`
  `void`
  `setSub(String sub)`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### sm

    protected static final StringManager sm

  - ### elements

    protected Substitution.SubstitutionElement[] elements

  - ### sub

    protected String sub

- ## Constructor Details

  - ### Substitution

    public Substitution()

- ## Method Details

  - ### getSub

    public String getSub()

  - ### setSub

    public void setSub(String sub)

  - ### parse

    public void parse(Map<String, RewriteMap> maps)

  - ### evaluate

    public String evaluate(Matcher rule, Matcher cond, Resolver resolver)
    Evaluate the substitution based on the context.
    Parameters:
      `rule` - corresponding matched rule
      `cond` - last matched condition
      `resolver` - The property resolver
    Returns:
      The substitution result