[jsr369-experts] encoded context path!?!?

From: Greg Wilkins <gregw_at_webtide.com>
Date: Thu, 8 Sep 2016 15:24:59 +1000


I've just discovered that jetty is not correctly implementing
HttpServletRequest.getContextPath(), which you would think would be a
pretty fundamental thing!

According to the javadoc
the container does not decode the string, so it would not return "/context
path", rather it should return "/content%20path", or even "
/c%6Fntent%20path" if that is what the client sent!

Luckily such encoded context paths are very rare!

However, we would like to be compliant, so we are fixing this, but I'd just
like to check regarding ServletContext.getContextPath(), as its javadoc
does not mention if it is encoded or not. I would assume that it is?

Eitherway, we should probably fix the javadoc for that.


PS. Does anybody know the reason getContextPath is encoded while
getServletPath and getPathInfo are not? I had always thought only
getRequestURI was encoded?

Greg Wilkins <gregw@webtide.com> CTO http://webtide.com