Description
ServletExternalContextImpl.encodeRedirectURL() doesn't work correctly if the base URL already contains encoded query parameters. In this case the resulting URL contains the query parameter encoded twice, which completely breaks them.
Take a look at this example:
externalContext.encodeRedirectURL("/test?p1=a+b", null);
Result ----> /test?p1=a%2Bb
Another example are encoded ampersand:
externalContext.encodeRedirectURL("/test?p1=a%26b", null);
Result ----> /test?p1=a%2526b
The root cause of the problem seems to be that ServletExternalContextImpl.encodeURL() doesn't decode the query parameters while parsing the base URL.