Class RuleContainer
- java.lang.Object
-
- org.eclipse.jetty.rewrite.handler.Rule
-
- org.eclipse.jetty.rewrite.handler.RuleContainer
-
- All Implemented Interfaces:
Dumpable
- Direct Known Subclasses:
RewriteCustomizer
,VirtualHostRuleContainer
public class RuleContainer extends Rule implements Dumpable
Base container to group rules. Can be extended so that the contained rules will only be applied under certain conditions
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.ApplyURI
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_originalPathAttribute
protected java.lang.String
_originalQueryStringAttribute
protected boolean
_rewritePathInfo
protected boolean
_rewriteRequestURI
protected Rule[]
_rules
static java.lang.String
ORIGINAL_QUERYSTRING_ATTRIBUTE_SUFFIX
-
Fields inherited from class org.eclipse.jetty.rewrite.handler.Rule
_handling, _terminating
-
-
Constructor Summary
Constructors Constructor Description RuleContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRule(Rule rule)
Add a Ruleprotected java.lang.String
apply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Process the contained rules (called by matchAndApply)void
dump(java.lang.Appendable out, java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.java.lang.String
getOriginalPathAttribute()
Rule[]
getRules()
Returns the list of rules.boolean
isRewritePathInfo()
boolean
isRewriteRequestURI()
java.lang.String
matchAndApply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Process the contained rulesvoid
setOriginalPathAttribute(java.lang.String originalPathAttribte)
void
setRewritePathInfo(boolean rewritePathInfo)
void
setRewriteRequestURI(boolean rewriteRequestURI)
void
setRules(Rule[] rules)
Assigns the rules to process.-
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
isHandling, isTerminating, setHandling, setTerminating, toString
-
-
-
-
Field Detail
-
ORIGINAL_QUERYSTRING_ATTRIBUTE_SUFFIX
public static final java.lang.String ORIGINAL_QUERYSTRING_ATTRIBUTE_SUFFIX
- See Also:
- Constant Field Values
-
_rules
protected Rule[] _rules
-
_originalPathAttribute
protected java.lang.String _originalPathAttribute
-
_originalQueryStringAttribute
protected java.lang.String _originalQueryStringAttribute
-
_rewriteRequestURI
protected boolean _rewriteRequestURI
-
_rewritePathInfo
protected boolean _rewritePathInfo
-
-
Method Detail
-
setRules
public void setRules(Rule[] rules)
Assigns the rules to process.- Parameters:
rules
- an array ofRule
.
-
addRule
public void addRule(Rule rule)
Add a Rule- Parameters:
rule
- The rule to add to the end of the rules array
-
isRewriteRequestURI
public boolean isRewriteRequestURI()
- Returns:
- the rewriteRequestURI If true, this handler will rewrite the value
returned by
HttpServletRequest.getRequestURI()
.
-
setRewriteRequestURI
public void setRewriteRequestURI(boolean rewriteRequestURI)
- Parameters:
rewriteRequestURI
- true if this handler will rewrite the value returned byHttpServletRequest.getRequestURI()
.
-
isRewritePathInfo
public boolean isRewritePathInfo()
- Returns:
- true if this handler will rewrite the value
returned by
HttpServletRequest.getPathInfo()
.
-
setRewritePathInfo
public void setRewritePathInfo(boolean rewritePathInfo)
- Parameters:
rewritePathInfo
- true if this handler will rewrite the value returned byHttpServletRequest.getPathInfo()
.
-
getOriginalPathAttribute
public java.lang.String getOriginalPathAttribute()
- Returns:
- the originalPathAttribte. If non null, this string will be used as the attribute name to store the original request path.
-
setOriginalPathAttribute
public void setOriginalPathAttribute(java.lang.String originalPathAttribte)
- Parameters:
originalPathAttribte
- If non null, this string will be used as the attribute name to store the original request path.
-
matchAndApply
public java.lang.String matchAndApply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
Process the contained rules- Specified by:
matchAndApply
in classRule
- Parameters:
target
- target field to pass on to the contained rulesrequest
- request object to pass on to the contained rulesresponse
- response object to pass on to the contained rules- Returns:
- The new target if the rule has matched, else null
- Throws:
java.io.IOException
- if unable to match the rule
-
apply
protected java.lang.String apply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
Process the contained rules (called by matchAndApply)- Parameters:
target
- target field to pass on to the contained rulesrequest
- request object to pass on to the contained rulesresponse
- response object to pass on to the contained rules- Returns:
- the target
- Throws:
java.io.IOException
- if unable to apply the rule
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
-
-