Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HttpServletRequest.getPathInfo() inconsistent behavior

On 30/11/2012 20:51, ccleve wrote:
When I put a webapp in /webapps/mycontext and have a web.xml specify a servlet that responds to "/":

<servlet-name>myservlet</servlet-name>
<url-pattern>/</url-pattern>

HttpServletRequest.getPathInfo() returns the correct part of the URL:

http://foo.com/mycontext/blah

.getPathInfo() -> "/blah"

When I mount the servlet programmatically, though, getPathInfo() returns null.

ServletContextHandler s = new ServletContextHandler();
s.setContextPath("/mycontext");
s.addServlet(MyServlet.class, "/");


try s.addServlet(MyServlet.class, "/*");


Back to the top