yoav.str
yoav.str

Reputation: 1534

tomcat double decode url

I am using spring security and spring mvc i want to send in get method [email protected]

1.when i typing in the browser localhost:8080/myServlerturl/login?user=1%[email protected] i am getting in the /login request.getParameterMap().get("user") is 1+1

2.when i typing in the browser localhost:8080/myServlerturl/[email protected] i am getting in the /login request.getParameterMap().get("user") is 1 1

i deduce from this that that the tomcat do double encdoing meaning the browser change 1+1 to 1%2B1 (browser always decode url) tomcat change it to 1 1 meaning double encode .

i see in the first filter I have the parameter as 1 1 insead of seeing it as 1+1

(url encode)(2 X decode by tomcat ) = decode X 1 too much

Upvotes: 0

Views: 823

Answers (1)

mindas
mindas

Reputation: 26733

Some characters have to be percent encoded in URLs, no matter what. This is how HTTP works.

Your 2)nd case doesn't make much sense. If such a URL is generated (without percent encoding + sign), it is generated incorrectly and must be fixed.

Upvotes: 1

Related Questions