Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Engine 2.0.2
-
None
Description
According to the servlet specification, a servlet registered with path "/" in its web application is considered a default servlet. For such a default servlet the HttpServletRequest.getServletPath() and HttpServletRequest.getPathInfo() methods return different results as would be expected: getServletPath() returns the request URI path (minus the servlet context path) and getPathInfo() always returns null.
When Sling is deployed using the PAX Web 0.5.1 this situation happens since the SlingMainServlet is registered with path "/" with the HttpService.
To fix this situation for Sling and ensuring the expected getServletPath() (of minor use in Sling) and getPathInfo() (very important for all authentication as well as resource resolution), the Sling engine is modified as follows:
- The SlingMainServlet is always registered with the HttpService with the servlet path "/". This cannot be configurable.
- The SlingHttpServletRequestImpl, which is instantiated by the SlingMainServlet to provide the SlingHttpServletRequest interface, is modified to overwrite the getServletPath() and getPathInfo() methods as follows (see also Section SRV.4.4 in Servlet API 2.4 spec) :
- getServletPath() always returns ""
- getPathInfo() always returns the getServletPath()+getPathInfo()
called on the servlet container (or HttpService provided)
HttpServletRequest object
More information on this issue is available in the Mail Thread http://markmail.org/message/34cithemwzadolw3