Class HeaderRegexRule
- java.lang.Object
-
- org.eclipse.jetty.rewrite.handler.Rule
-
- org.eclipse.jetty.rewrite.handler.RegexRule
-
- org.eclipse.jetty.rewrite.handler.HeaderRegexRule
-
public class HeaderRegexRule extends RegexRule
Rule to add a header based on a Regex match
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.ApplyURI
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.rewrite.handler.Rule
_handling, _terminating
-
-
Constructor Summary
Constructors Constructor Description HeaderRegexRule()HeaderRegexRule(java.lang.String regex, java.lang.String name, java.lang.String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Stringapply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.regex.Matcher matcher)Apply this rule to the request/response pair.java.lang.StringgetName()Returns the header name.java.lang.StringgetValue()Returns the header value.booleanisAdd()voidsetAdd(boolean add)Sets the Add flag.voidsetName(java.lang.String name)Sets the header name.voidsetValue(java.lang.String value)Sets the header value.java.lang.StringtoString()Returns the regular expression string.-
Methods inherited from class org.eclipse.jetty.rewrite.handler.RegexRule
getRegex, matchAndApply, setRegex
-
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
isHandling, isTerminating, setHandling, setTerminating
-
-
-
-
Method Detail
-
setName
public void setName(java.lang.String name)
Sets the header name.- Parameters:
name- name of the header field
-
setValue
public void setValue(java.lang.String value)
Sets the header value. The value can be either aStringorintvalue.- Parameters:
value- of the header field
-
setAdd
public void setAdd(boolean add)
Sets the Add flag.- Parameters:
add- If true, the header is added to the response, otherwise the header it is set on the response.
-
apply
protected java.lang.String apply(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.regex.Matcher matcher) throws java.io.IOExceptionDescription copied from class:RegexRuleApply this rule to the request/response pair. Called byRegexRule.matchAndApply(String, HttpServletRequest, HttpServletResponse)if the regex matches.- Specified by:
applyin classRegexRule- Parameters:
target- field to attempt matchrequest- request objectresponse- response objectmatcher- The Regex matcher that matched the request (with capture groups available for replacement).- Returns:
- The target (possible updated).
- Throws:
java.io.IOException- exceptions dealing with operating on request or response objects
-
getName
public java.lang.String getName()
Returns the header name.- Returns:
- the header name.
-
getValue
public java.lang.String getValue()
Returns the header value.- Returns:
- the header value.
-
isAdd
public boolean isAdd()
- Returns:
- the add flag value.
-
-