Hi,

I'm observing a behavior (Tomcat 9.0.10) with respect to getServletPath()
that I don't understand when reading the servlet spec.

For a request http://localhost:8080/nuxeo/ui/ I get the following:

httpRequest.getRequestURL()
http://localhost:8080/nuxeo/ui/
httpRequest.getRequestURI()
/nuxeo/ui/
httpRequest.getContextPath()
/nuxeo
httpRequest.getServletPath()
/ui/index.jsp
httpRequest.getPathInfo()
null
httpRequest.getQueryString()
null

But my understanding from the Servlet spec is that we should always have
(Servlet 4.0 spec, ยง3.5):
requestURI = contextPath + servletPath + pathInfo
which you can see is not the case here. I don't think getServletPath()
should return the index.jsp part, which is a welcome file.

FYI the mapping that matches the above is:
httpRequest.getHttpServletMapping().getServletName()
(java.lang.String) jsp
httpRequest.getHttpServletMapping().getMappingMatch()
(javax.servlet.http.MappingMatch) EXTENSION
httpRequest.getHttpServletMapping().getPattern()
(java.lang.String) *.jsp
httpRequest.getHttpServletMapping().getMatchValue()
(java.lang.String) ui/index

Is this a bug in Tomcat or did I miss something from the spec?

Thanks,
Florent

-- 
[image: Nuxeo Logo] <https://www.nuxeo.com/>

Florent Guillaume  Head of R&D  [image: LinkedIn]
<https://www.linkedin.com/in/fguillaume/> [image: Twitter]
<https://twitter.com/efge> [image: Github] <https://github.com/efge>

Nuxeo Content Services Platform. Stay ahead.

Reply via email to