Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-736

Ensure getPathInfo returns correct (expected) value

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Engine 2.0.2
    • Fix Version/s: Engine 2.0.4
    • Component/s: Engine
    • Labels:
      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

        Attachments

        1. SLING-736.patch
          5 kB
          Felix Meschberger

          Activity

            People

            • Assignee:
              jvazquez Juan Vazquez
              Reporter:
              fmeschbe Felix Meschberger
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: