public class RewriteValve extends ValveBase
Lifecycle.SingleUse
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 java.lang.ThreadLocal<java.lang.Boolean> |
invoked
If rewriting occurs, the whole request will be processed again.
|
protected java.util.Map<java.lang.String,RewriteMap> |
maps
Maps to be used by the rules.
|
protected java.lang.String |
resourcePath
Relative path to the configuration file.
|
protected RewriteRule[] |
rules
The rewrite rules that the valve will use.
|
asyncSupported, container, containerLog, next, sm
mserver
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
RewriteValve() |
Modifier and Type | Method and Description |
---|---|
protected java.io.File |
getConfigBase()
Get config base.
|
java.lang.String |
getConfiguration() |
boolean |
getEnabled() |
protected java.lang.String |
getHostConfigPath(java.lang.String resourceName)
Find the configuration path where the rewrite configuration file
will be stored.
|
protected static boolean |
hasScheme(java.lang.StringBuffer uri)
Deprecated.
Unused. Will be removed in 8.5.x.
|
protected void |
initInternal()
Sub-classes wishing to perform additional initialization should override
this method, ensuring that super.initInternal() is the first call in the
overriding method.
|
void |
invoke(Request request,
Response response)
The implementation-specific logic represented by this Valve.
|
protected void |
parse(java.io.BufferedReader reader) |
static java.lang.Object |
parse(java.lang.String line)
This factory method will parse a line formed like:
Example:
RewriteCond %{REMOTE_HOST} ^host1.* [OR]
|
protected static void |
parseCondFlag(java.lang.String line,
RewriteCond condition,
java.lang.String flag)
Parser for RewriteCond flags.
|
protected static void |
parseRuleFlag(java.lang.String line,
RewriteRule rule,
java.lang.String flag)
Parser for RewriteRule flags.
|
void |
setConfiguration(java.lang.String configuration) |
void |
setEnabled(boolean enabled) |
protected void |
startInternal()
Start this component and implement the requirements
of
LifecycleBase.startInternal() . |
protected void |
stopInternal()
Stop this component and implement the requirements
of
LifecycleBase.stopInternal() . |
backgroundProcess, event, getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, isAsyncSupported, setAsyncSupported, setContainer, setNext, toString
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
protected RewriteRule[] rules
protected java.lang.ThreadLocal<java.lang.Boolean> invoked
protected java.lang.String resourcePath
protected boolean context
protected boolean enabled
protected java.util.Map<java.lang.String,RewriteMap> maps
public boolean getEnabled()
public void setEnabled(boolean enabled)
protected void initInternal() throws LifecycleException
LifecycleMBeanBase
initInternal
in class ValveBase
LifecycleException
protected void startInternal() throws LifecycleException
ValveBase
LifecycleBase.startInternal()
.startInternal
in class ValveBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void setConfiguration(java.lang.String configuration) throws java.lang.Exception
java.lang.Exception
public java.lang.String getConfiguration()
protected void parse(java.io.BufferedReader reader) throws LifecycleException
LifecycleException
protected void stopInternal() throws LifecycleException
ValveBase
LifecycleBase.stopInternal()
.stopInternal
in class ValveBase
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void invoke(Request request, Response response) throws java.io.IOException, ServletException
ValveBase
This method MUST be provided by a subclass.
invoke
in interface Valve
invoke
in class ValveBase
request
- The servlet request to be processedresponse
- The servlet response to be createdjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occursprotected java.io.File getConfigBase()
protected java.lang.String getHostConfigPath(java.lang.String resourceName)
resourceName
- public static java.lang.Object parse(java.lang.String line)
line
- A line from the rewrite configurationprotected static void parseCondFlag(java.lang.String line, RewriteCond condition, java.lang.String flag)
condition
- flag
- protected static void parseRuleFlag(java.lang.String line, RewriteRule rule, java.lang.String flag)
rule
- flag
- @Deprecated protected static boolean hasScheme(java.lang.StringBuffer uri)
scheme
component.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.