You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/01/31 13:36:03 UTC
[Bug 64109] New: Bad handling of special "" URI mapping rule
https://bz.apache.org/bugzilla/show_bug.cgi?id=64109
Bug ID: 64109
Summary: Bad handling of special "" URI mapping rule
Product: Tomcat 9
Version: 9.0.30
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Servlet
Assignee: dev@tomcat.apache.org
Reporter: gr.grzybek@gmail.com
Target Milestone: -----
I'm checking Servlet 4 specification, 12.2, "Specification of Mappings" chapter
(when working on Pax Web).
I know this rule is a bit confusing:
> The empty string ("") is a special URL pattern that exactly maps to the
> application's context root, i.e., requests of the form
> http://host:port/<context-root>/. In this case the path info
> is "/" and the servlet path and context path is empty string ("").
But I see that `org.apache.catalina.mapper.Mapper#internalMapExactWrapper()`
works fine - even if I have "/c1" context and "" path mapped to some servlet,
`internalMapExactWrapper()` sets proper values:
// Special handling for Context Root mapped servlet
mappingData.pathInfo.setString("/");
mappingData.wrapperPath.setString("");
// This seems wrong but it is what the spec says...
mappingData.contextPath.setString("");
However, inside actual servlet,
`org.apache.catalina.connector.Request#getContextPath()` returns "/c1" as
context path even if underlying
org.apache.catalina.connector.Request#mappingData contains proper (though
confusing according to specification) values.
Is this intended? It could be that JavaDoc for
`javax.servlet.http.HttpServletRequest#getContextPath()` is _better_ and just
says nothing about the special mapping rule from specification chapter 12.2...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64109] Bad handling of special "" URI mapping rule
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64109
--- Comment #2 from Mark Thomas <ma...@apache.org> ---
The spec text looks very wrong to me. I opened an issue:
https://github.com/eclipse-ee4j/servlet-api/issues/300
Separately, we can / should remove mappingData.contextPath since it is now
unused.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64109] Bad handling of special "" URI mapping rule
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64109
Remy Maucherat <re...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WORKSFORME
Status|NEW |RESOLVED
--- Comment #1 from Remy Maucherat <re...@apache.org> ---
The spec language does not make much sense.
Internally the context path is the "right" value if used through some internal
API (it is unused right now) so this is "ok", and Request.getContextPath is
also right (it reconstructs a context path and so will not be the same).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64109] Bad handling of special "" URI mapping rule
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64109
Grzegorz Grzybek <gr...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|WORKSFORME |FIXED
--- Comment #3 from Grzegorz Grzybek <gr...@gmail.com> ---
Thanks for explanation and for eclipse-ee4j/servlet-api issue.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org