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 org.eclipse.jetty.rewrite.handler.Rule
Rule.Handler, Rule.HttpURIHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()booleanprotected booleanisValidChar(int codepoint) matchAndApply(Rule.Handler input) Tests whether the givenRequestshould apply, and if so the rule logic is triggered.voidsetCode(int code) voidsetMessage(String message) Sets the message for the response body (if the response code may have a body).toString()Returns the handling and terminating flag values.Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
setTerminating
-
Constructor Details
-
InvalidURIRule
public InvalidURIRule()
-
-
Method Details
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminatingin classRule- Returns:
- when
true, rules after this one are not invoked
-
getCode
public int getCode() -
setCode
public void setCode(int 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
Requestshould apply, and if so the rule logic is triggered.- Specified by:
matchAndApplyin classRule- Parameters:
input- the inputRequestandHandler- Returns:
- the possibly wrapped
RequestandHandler, ornullif the rule did not match - Throws:
IOException- if applying the rule failed
-
isValidChar
protected boolean isValidChar(int codepoint) -
toString
Description copied from class:RuleReturns the handling and terminating flag values.
-