[ 
https://issues.apache.org/jira/browse/WW-5842?focusedWorklogId=1053216&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1053216
 ]

ASF GitHub Bot logged work on WW-5842:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Nov/26 11:01
            Start Date: 07/Nov/26 11:01
    Worklog Time Spent: 10m 
      Work Description: sonarqubecloud[bot] commented on PR #2119:
URL: https://github.com/apache/struts/pull/2119#issuecomment-6705953856

   ## [![Quality Gate 
Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png
 'Quality Gate 
Failed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=2119) 
**Quality Gate failed**  
   Failed conditions  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png
 '') [4.1% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2119&metric=new_duplicated_lines_density&view=list)
 (required ≤ 3%)  
     
   <!

Issue Time Tracking
-------------------

    Worklog Id:     (was: 1053216)
    Time Spent: 50m  (was: 40m)

> Action mapping should rely on the servlet path and path info reported by the 
> container
> --------------------------------------------------------------------------------------
>
>                 Key: WW-5842
>                 URL: https://issues.apache.org/jira/browse/WW-5842
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 6.13.0, 7.5.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> RequestUtils.getServletPath derives the path to map from 
> HttpServletRequest.getRequestURI() in two cases: when the request URI does 
> not end with the servlet path reported by the container (WW-2268, to keep a 
> {{;jsessionid=...}} suffix), and when the container reports an empty servlet 
> path, as it does for a servlet mapped to {{/*}}. In both cases the value 
> comes from the raw request URI, so it differs from the servlet path and path 
> info the container has already decoded: it still carries percent-encoding and 
> path parameters. {{DefaultActionMapper}} then drops everything after the 
> first {{;}}, and {{RestActionMapper}} keeps a trailing {{;edit}} to select 
> the edit method (WW-4585 added the same handling to the {{!method}} form).
> Every consumer of the helper afterwards works with the container's view of 
> the request (action name and namespace, the exclusion patterns, the static 
> resource lookup, {{<s:include>}} and {{ResourceUtil}}), so the reconstruction 
> is a second interpretation of the same request that can differ from the 
> container's.
> h2. Proposed change
> * {{RequestUtils.getServletPath}} returns the servlet path followed by the 
> path info, both as reported by the container; the request URI is no longer 
> consulted. {{getUri}} keeps its include-attribute handling.
> * {{DefaultActionMapper}} and {{RestActionMapper}} no longer treat {{;}} in 
> the mapped path specially. On a Servlet 3+ container path parameters never 
> reach the servlet path or the path info, so {{;jsessionid=...}} needs no 
> handling in Struts.
> * The REST plugin's {{;edit}} form ({{GET /movies/Thrillers;edit}}) is 
> removed. {{GET /movies/Thrillers/edit}} is the documented equivalent and 
> continues to work; the plugin documentation drops the {{;edit}} example. 
> {{RestActionMapper.setEditMethodName}} becomes a deprecated no-op (removal: 
> WW-5843); {{RestWorkflowInterceptor}} keeps reading 
> {{struts.mapper.editMethodName}}.
> * {{ExecuteOperations}} no longer needs its own path-info fallback for an 
> empty servlet path.
> * The JUnit plugin's {{executeAction}}, {{getActionProxy}} and 
> {{getActionMapping}} helpers set the servlet path on the mock request as well 
> as the request URI.
> h2. Compatibility
> * Applications linking to the REST {{;edit}} form have to switch to {{/edit}}.
> * With a servlet mapped to {{/*}} in front of Struts, the action path is now 
> taken from the decoded path info rather than from the raw request URI.
> * Tests that drive Struts with a mock request (for example Spring's 
> {{MockHttpServletRequest}}) must set the servlet path, not only the request 
> URI, as a container would; the JUnit plugin helpers do this already.
> Same change on the 6.x line.
> Reported by Svyatoslav Berestovsky.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to