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.UnicodeBlockis 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 Rule
Rule.Handler, Rule.HttpURIHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()booleanprotected booleanisValidChar(int codepoint) matchAndApply(Rule.Handler input) Tests whether the given inputHandler(which wraps aRequest) matches the rule, and if so returns an outputHandlerthat applies the rule logic.voidsetCode(int code) Set the response code.voidsetMessage(String message) Sets the message for the response body (if the response code may have a body).toString()Methods inherited from class Rule
setTerminating
-
Constructor Details
-
InvalidURIRule
public InvalidURIRule()
-
-
Method Details
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminatingin 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:RuleTests whether the given input
Handler(which wraps aRequest) matches the rule, and if so returns an outputHandlerthat applies the rule logic.If the input does not match,
nullis returned.- Specified by:
matchAndApplyin classRule- Parameters:
input- the inputHandlerthat wraps theRequest- Returns:
- an output
Handlerthat wraps the inputHandler, ornullif the rule does not match - Throws:
IOException- if applying the rule fails
-
isValidChar
protected boolean isValidChar(int codepoint) -
toString
-