Class ValidUrlRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.ValidUrlRule
This rule can be used to protect against invalid unicode characters in a url making it into applications.
The logic is as follows.
- if decoded uri character is an iso control character return code/reason
- if no UnicodeBlock is found for character return code/reason
- if character is in UnicodeBlock.SPECIALS return code/reason
-
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
isValidChar
(int codepoint) matchAndApply
(String target, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) This method calls tests the rule against the request/response pair and if the Rule applies, then the rule's action is triggered.void
Sets the response status code.void
setMessage
(String message) Sets the message for theResponse.sendError(int, String)
method.toString()
Returns the handling and terminating flag values.Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
isHandling, isTerminating, setHandling, setTerminating
-
Constructor Details
-
ValidUrlRule
public ValidUrlRule()
-
-
Method Details
-
setCode
Sets the response status code.- Parameters:
code
- response code
-
setMessage
Sets the message for theResponse.sendError(int, String)
method.- Parameters:
message
- the message
-
matchAndApply
public String matchAndApply(String target, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Description copied from class:Rule
This method calls tests the rule against the request/response pair and if the Rule applies, then the rule's action is triggered.- Specified by:
matchAndApply
in classRule
- Parameters:
target
- The target of the requestrequest
- the requestresponse
- the response- Returns:
- The new target if the rule has matched, else null
- Throws:
IOException
- if unable to match the rule
-
isValidChar
protected boolean isValidChar(int codepoint) -
toString
Description copied from class:Rule
Returns the handling and terminating flag values.
-