[ 
https://issues.apache.org/jira/browse/SLING-736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger updated SLING-736:
------------------------------------

    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

  was:
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



> Ensure getPathInfo returns correct (expected) value
> ---------------------------------------------------
>
>                 Key: SLING-736
>                 URL: https://issues.apache.org/jira/browse/SLING-736
>             Project: Sling
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: Engine 2.0.2
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: Engine 2.0.4
>
>         Attachments: SLING-736.patch
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to