On 05/06/2012 20:57, Konstantin Kolinko wrote: > 2012/6/5 <ma...@apache.org>: >> Author: markt >> Date: Tue Jun 5 18:17:58 2012 >> New Revision: 1346510
>> --- >> tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperContextRoot.java >> (added) >> +++ >> tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperContextRoot.java >> Tue Jun 5 18:17:58 2012 >> @@ -0,0 +1,79 @@ >> + private static class Bug53356Servlet extends HttpServlet { >> + >> + private static final long serialVersionUID = 1L; >> + >> + @Override >> + protected void doGet(HttpServletRequest req, HttpServletResponse >> resp) >> + throws ServletException, IOException { >> + // Confirm behaviour as per Servler 12.2 >> + boolean pass = "/".equals(req.getPathInfo()); >> + if (pass) { >> + pass = (req.getServletPath() == null); >> + } >> + if (pass) { >> + pass = (req.getContextPath() == null); >> + } >> + > > Looking into Servlet spec 3.0 rev.a chapter 12.2. > > It says that contextPath and servletPath are empty string (""), but > the code above expects nulls. I'll get that fixed. I mis-read the spec. > Regarding contextPath being "": > It is surely strange, as > > 1. it contradicts other places like 3.5 (definition of "Context Path" > and famous equation of requestURI = contextPath + servletPath + > pathInfo ). > > 2. There is also ServletContext.getContextPath() that provides the > correct information. > > 3. Though looking at Javadoc [3], it says that > HttpServletRequest.getContextPath() may be different with > ServletContext.getContextPath(), but it does not mention this special > servlet mapping as a case. > > [3] > http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getContextPath%28%29 > > I wonder if it was ever raised with the EG. Not that I am aware of. > It is worth mentioning the chapter number (12.2) in the comment in Mapper.java > > I suspect that this feature is not covered by official tests, because > otherwise we would have had to deal with it earlier. Correct. I'm not surprised. > So maybe we should respect ch.3.5 here, instead of 12.2? Until the EG says otherwise, I think we should go with 12.2 Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org