You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2010/01/12 12:42:54 UTC

[jira] Created: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

ServletHandlerRequest.getPathInfo() returns undecoded string
------------------------------------------------------------

                 Key: FELIX-1979
                 URL: https://issues.apache.org/jira/browse/FELIX-1979
             Project: Felix
          Issue Type: Bug
          Components: HTTP Service
    Affects Versions: http-2.0.4
            Reporter: Felix Meschberger
             Fix For: http-2.0.6


The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.

The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Commented: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Sten Roger Sandvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800128#action_12800128 ] 

Sten Roger Sandvik commented on FELIX-1979:
-------------------------------------------

Yes. That would be another approach. URLDecode approach is atleast server-container neutral (if for some reason some servlet containers do this differently).


> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Assigned: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-1979:
----------------------------------------

    Assignee: Felix Meschberger

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Resolved: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-1979.
--------------------------------------

    Resolution: Fixed

Applied proposed patch in Rev. 898301.

The path info string is now decoded using URLDecoder.decode with "UTF-8" encoding as recommended.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Commented: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804458#action_12804458 ] 

Felix Meschberger commented on FELIX-1979:
------------------------------------------

Oops, sorry, forgot the fixes to the test case. Commited in Rev. 902741.

The problem with the testcase was, that the getPathInfo() method was not mocked and thus null was returned instead of the expected value.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979-2.patch, FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Reopened: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reopened FELIX-1979:
--------------------------------------


I think the second patch based on the servlet container's path info is better.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979-2.patch, FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Updated: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-1979:
-------------------------------------

    Attachment: FELIX-1979-2.patch

Another patch basing on the servlet container's pathInfo.

Since this code is only called if the servlet container's pathInfo ensures the servlet alias, we can just cut off the servlet alias and be done.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979-2.patch, FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Resolved: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-1979.
--------------------------------------

    Resolution: Fixed

Applied the second patch in Rev. 902619.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979-2.patch, FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Commented: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "J.W. Janssen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804452#action_12804452 ] 

J.W. Janssen commented on FELIX-1979:
-------------------------------------

Tried the patch(es), but it causes ServletHandlerRequestTest#testPathInfo to fail. Have not yet figured out what causes it.

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979-2.patch, FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Commented: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799665#action_12799665 ] 

Felix Meschberger commented on FELIX-1979:
------------------------------------------

Reconsidering, I wonder, whether we could not just use the actual servlet container's patchInfo and cut off the servlet alias from the front instead of decoding ourselves ?

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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


[jira] Updated: (FELIX-1979) ServletHandlerRequest.getPathInfo() returns undecoded string

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-1979:
-------------------------------------

    Attachment: FELIX-1979.patch

Proposed patch just calling URLDecoder.decode to decode the path info string using UTF-8 encoding as recommended by http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars

> ServletHandlerRequest.getPathInfo() returns undecoded string
> ------------------------------------------------------------
>
>                 Key: FELIX-1979
>                 URL: https://issues.apache.org/jira/browse/FELIX-1979
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: Felix Meschberger
>             Fix For: http-2.0.6
>
>         Attachments: FELIX-1979.patch
>
>
> The Servlet API specifies the HttpServletRequest.getPathInfo() to return a decoded path string.
> The current implementation just cuts off the servlet context and servlet alias from the request URL (retrieved from HttpServletRequest.getRequestURI()), which is not decoded. Therefore the resulting path info is also not decoded and needs decoding.

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