Note
Extra caution should be used when adding a Rewrite Rule. When specifying a regex to match for in a Rewrite Rule, certain regex could allow an attacker to DoS your server, as Java's regex parsing is vulnerable to "catastrophic backtracking" (also known as "Regular expression Denial of Service", or ReDoS). There are some open source tools to help detect vulnerable regex, though in general it is a hard problem. A good defence is to use a regex debugger on your desired regex, and read more on the subject of catastrophic backtracking.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | context
Will be set to true if the valve is associated with a context. |
| protected boolean | enabled
enabled this component |
| protected ThreadLocal | invoked
If rewriting occurs, the whole request will be processed again. |
| protected Map | maps
Maps to be used by the rules. |
| protected ArrayList | mapsConfiguration
Maps configuration. |
| protected String | resourcePath
Relative path to the configuration file. |
| protected RewriteRule[] | rules
The rewrite rules that the valve will use. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public boolean | |
| protected void | initInternal()
Overrides org. Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method. |
| public void | invoke(Request
The servlet request to be processed request, Response The servlet response to be created response)Implements org. Perform request processing as required by this Valve. |
| protected void | |
| public static Object | |
| protected static void | parseCondFlag(String
The configuration line being parsed line, RewriteCond The current condition condition, String The flag flag)Parser for RewriteCond flags. |
| protected static void | parseRuleFlag(String
The configuration line being parsed line, RewriteRule The current rule rule, String The flag flag)Parser for RewriteRule flags. |
| public void | |
| public void | |
| protected void | startInternal()
Overrides org. Start this component and implement the requirements of
|
| protected void | stopInternal()
Overrides org. Stop this component and implement the requirements of
|
| context | back to summary |
|---|---|
| protected boolean context Will be set to true if the valve is associated with a context. | |
| enabled | back to summary |
|---|---|
| protected boolean enabled enabled this component | |
| invoked | back to summary |
|---|---|
| protected ThreadLocal<Boolean> invoked If rewriting occurs, the whole request will be processed again. | |
| maps | back to summary |
|---|---|
| protected Map<String, RewriteMap> maps Maps to be used by the rules. | |
| mapsConfiguration | back to summary |
|---|---|
| protected ArrayList<String> mapsConfiguration Maps configuration. | |
| resourcePath | back to summary |
|---|---|
| protected String resourcePath Relative path to the configuration file. Note If the valve's container is a context, this will be relative to /WEB-INF/. | |
| rules | back to summary |
|---|---|
| protected RewriteRule[] rules The rewrite rules that the valve will use. | |
| RewriteValve | back to summary |
|---|---|
| public RewriteValve() | |
| getConfiguration | back to summary |
|---|---|
| public String getConfiguration() | |
| getEnabled | back to summary |
|---|---|
| public boolean getEnabled() | |
| initInternal | back to summary |
|---|---|
| protected void initInternal() throws LifecycleException Overrides org. Doc from org. Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.
| |
| invoke | back to summary |
|---|---|
| public void invoke(Request request, Response response) throws IOException, ServletException Implements org. Doc from org. Perform request processing as required by this Valve. An individual Valve MAY perform the following actions, in the specified order:
A Valve MUST NOT do any of the following things:
| |
| parse | back to summary |
|---|---|
| protected void parse(BufferedReader reader) throws LifecycleException | |
| parse | back to summary |
|---|---|
| public static Object parse(String line) This factory method will parse a line formed like: Example: RewriteCond %{REMOTE_HOST} ^host1.* [OR] | |
| parseCondFlag | back to summary |
|---|---|
| protected static void parseCondFlag(String line, RewriteCond condition, String flag) Parser for RewriteCond flags.
| |
| parseRuleFlag | back to summary |
|---|---|
| protected static void parseRuleFlag(String line, RewriteRule rule, String flag) Parser for RewriteRule flags.
| |
| setConfiguration | back to summary |
|---|---|
| public void setConfiguration(String configuration) throws Exception | |
| setEnabled | back to summary |
|---|---|
| public void setEnabled(boolean enabled) | |
| startInternal | back to summary |
|---|---|
| protected void startInternal() throws LifecycleException Overrides org. Doc from org. Start this component and implement the requirements of
| |
| stopInternal | back to summary |
|---|---|
| protected void stopInternal() throws LifecycleException Overrides org. Doc from org. Stop this component and implement the requirements of
| |