Unexpected Results From HttpServletRequest.getPathInfo()
Using Jetty 6.1.18.
I have a web.xml defined like:
<servlet>
<servlet-name>root</servlet-name>
<servlet-class>RootServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>foo</servlet-name>
<servlet-class>FooServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>root</servlet-name><url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>foo</servlet-name><url-pattern>/foo/*</url-pattern>
</servlet-mapping>
I use the "/*" so that FooServlet handles "/foo/1", "/foo/2", etc.
In a browser, I request the following URL:
/foo/*
FooServlet is invoked. My expectation would be that the following would be true:
request.getRequestURI() = "/foo/*"
request.getContextPath() = ""
request.getServletPath() = "/foo"
request.getPathInfo() = "/*"
But instead I get:
request.getRequestURI() = "/foo/*"
request.getContextPath() = ""
request.getServletPath() = "/foo"
request.getPathInfo() = ""
In the Java Servlet Specification 2.5 MRel2, SRV.3.4, it says:
It is important to note that, except for URL encoding differences between the
request URI and the path parts, the following equation is always true:
requestURI = contextPath + servletPath + pathInfo
Is this a known issue? Thanks.