“This is the 9th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”



An example of an alternative way to access the interface is as follows:



Expect “JavaEdge:dev 666”, but when you run the code above, you’ll find something like this:



According to?

parsing

This requires mastery of URL handling:

UriComponentsBuilder# toUriString:

URL Encode



The call stack is as follows:





So far, all is fine, but when we convert the URL to a String and send the request as follows:



It will find that it encodes again:



At this point, you should understand why it went wrong: the case-by-case code performs Encode twice, so you end up getting unexpected surprises!

After 2 times of coding:

correction

Avoid multiple encoding by multiple conversions: