jsr369-experts@servlet-spec.java.net

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

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

All,

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
<http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getContextPath()>,
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.

regards

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