Class HeaderPatternRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.PatternRule
org.eclipse.jetty.rewrite.handler.HeaderPatternRule
Sets the header in the response whenever the rule finds a match.
-
Nested Class Summary
Nested classes/interfaces inherited from class Rule
Rule.ApplyURI -
Field Summary
FieldsFields inherited from class PatternRule
_patternFields inherited from class Rule
_handling, _terminating -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Invokes this method when a match found.getName()Returns the header name.getValue()Returns the header value.booleanisAdd()Returns the add flag value.voidsetAdd(boolean add) Sets the Add flag.voidSets the header name.voidSets the header value.toString()Returns the header contents.Methods inherited from class PatternRule
getPattern, matchAndApply, setPatternMethods inherited from class Rule
isHandling, isTerminating, setHandling, setTerminating
-
Field Details
-
_name
-
_value
-
_add
private boolean _add
-
-
Constructor Details
-
HeaderPatternRule
public HeaderPatternRule() -
HeaderPatternRule
-
-
Method Details
-
setName
-
setValue
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
public String apply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Invokes this method when a match found. If the header had already been set, the new value overwrites the previous one. Otherwise, it adds the new header name and value.- Specified by:
applyin classPatternRule- Parameters:
target- field to attempt matchrequest- request objectresponse- response object- Returns:
- The target (possible updated)
- Throws:
IOException- exceptions dealing with operating on request or response objects- See Also:
-
getName
-
getValue
-
isAdd
public boolean isAdd()Returns the add flag value.- Returns:
- true if add flag set
-
toString
-