Class InvalidURIRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.InvalidURIRule
Rule that protects against invalid unicode characters in URLs, returning a configurable status code with body message.
The logic is as follows:
- if a decoded URI character is an iso control character, apply the rule
- if no
Character.UnicodeBlock
is found for a decoded URI character, apply the rule - if a decoded URI character is in UnicodeBlock.SPECIALS, apply the rule
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.Handler, Rule.HttpURIHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getCode()
boolean
protected boolean
isValidChar
(int codepoint) matchAndApply
(Rule.Handler input) Tests whether the given inputHandler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.void
setCode
(int code) Set the response code.void
setMessage
(String message) Sets the message for the response body (if the response code may have a body).toString()
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
setTerminating
-
Constructor Details
-
InvalidURIRule
public InvalidURIRule()
-
-
Method Details
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminating
in classRule
- Returns:
- whether rules after this one are not invoked
-
getCode
public int getCode() -
setCode
public void setCode(int code) Set the response code.- Parameters:
code
- the response code
-
getMessage
-
setMessage
Sets the message for the response body (if the response code may have a body).
- Parameters:
message
- the response message
-
matchAndApply
Description copied from class:Rule
Tests whether the given input
Handler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.If the input does not match,
null
is returned.- Specified by:
matchAndApply
in classRule
- Parameters:
input
- the inputHandler
that wraps theRequest
- Returns:
- an output
Handler
that wraps the inputHandler
, ornull
if the rule does not match - Throws:
IOException
- if applying the rule fails
-
isValidChar
protected boolean isValidChar(int codepoint) -
toString
-