If tomcat throws below exception:
java.lang.IllegalArgumentException: Invalid character found in the request
target. The valid characters are defined in RFC 7230 and RFC 3986
Check below point….
Are you using tomcat 8 ?
Because there is | and ‘{‘, ‘}’ character
or some other character which is not supported by Tomcat 8. And it may through
below exception.
Tomcat - User - Tomcat 8.0.39 and
tomcat 8.5.8 fails handling request
Tomcat has increased the validation
of incoming HTTP requests to reject the requests that are not specification
compliant.
For the query string or parameters,
the RFC specific extracts from RFC 3986 are:
unreserved = ALPHA / DIGIT / "-" /
"." / "_" / "~"
query = *( pchar / "/" /
"?" )
sub-delims = "!" / "$" /
"&" / "'" / "(" / ")" /
"*" / "+" / "," / ";" / "="
pchar = unreserved / pct-encoded /
sub-delims / ":" / "@"
Hence, '{' and '}' are rejected.
Note:
In my request, I am sending a filter
JSON object to the server which includes ‘{‘and ‘}’ and is getting rejected.
Request:
http://localhost:8080/App/eqp?filters={"filters":{
"column":"xxx","operator":"LIKE","value":"111”}
But If you uses Tomcat Version 7, its working fine!!!
No comments:
Post a Comment