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

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

                Author: ASF GitHub Bot
            Created on: 07/Nov/26 10:54
            Start Date: 07/Nov/26 10:54
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #2118:
URL: https://github.com/apache/struts/pull/2118

   Fixes [WW-5842](https://issues.apache.org/jira/browse/WW-5842)
   
   `RequestUtils.getServletPath` rebuilt the path from the raw request URI 
whenever the container's servlet path did not end the URI (WW-2268) or was 
empty, so the mapper worked on a second interpretation of the request that 
could differ from the container's. It now returns the servlet path followed by 
the path info, both as reported by the container, and `getUri` no longer falls 
back to the raw request URI.
   
   With the container stripping path parameters before computing those values, 
the mappers no longer handle `;` themselves:
   
   - `DefaultActionMapper` drops its cut at the first `;`.
   - `RestActionMapper` drops the `;jsessionid` handling (including the WW-4585 
`!method;` form) and the `;edit` URL form. `setEditMethodName` becomes a 
deprecated no-op, removal tracked in WW-5843; `RestWorkflowInterceptor` keeps 
reading `struts.mapper.editMethodName`.
   - `ExecuteOperations` drops its path-info fallback for an empty servlet path.
   
   Test fixtures that set only the request URI now also set the servlet path, 
as a container would. The JUnit plugin helpers (`executeAction`, 
`getActionProxy`, `getActionMapping`) do the same for the mock request they 
build.
   
   **Breaking change:** the REST plugin no longer recognises the `;edit` URL 
form; use the documented `/edit` form. Tests driving Struts with a mock request 
must set the servlet path, not only the request URI.
   
   Docs: the REST plugin page drops the `;edit` example in a struts-site PR.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




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

            Worklog Id:     (was: 1053212)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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: 10m
>  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