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

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

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

   Fixes [WW-5849](https://issues.apache.org/jira/browse/WW-5849)
   
   ## What
   
   A design document for a new `forward` result: a server-side transfer from 
one action to another within the same request. It is meant to replace action 
chaining (the `chain` result plus `ChainingInterceptor`). Design only; no code 
yet.
   
   ## Why
   
   The "Is anyone using action chaining?" thread on user@ showed that chaining 
is still in use, mostly for server-side branching where the next action depends 
on the current one's state, without an extra browser round-trip. 
`redirectAction` and moving logic into services don't cover that, so chaining 
can't simply be removed.
   
   Chaining also does much more than that hand-off needs: any action can be 
chained to, the target name is an expression, every value-stack property is 
copied by name, and the source action stays in the target's value stack. The 
design keeps the hand-off and makes both boundaries explicit:
   
   - **which actions can be forwarded to**: a target-side allowlist 
(non-inherited annotation or an `<action>` attribute)
   - **what data crosses**: request parameters bound again under the target's 
own `@StrutsParameter` rules, plus an explicit hand-off named on both sides; 
fresh value stack, no property copying
   
   ## Rollout
   
   - 7.6.0: `forward` + `struts-7.6.dtd`; `chain` unchanged
   - 7.7.0: deprecate `chain`, with a log of copied properties as a migration 
aid
   - 8.0.0: remove `chain`
   
   ## Review focus
   
   The calls marked in the document that weren't settled in discussion: 
hand-off applied by a dedicated interceptor after `params`, hand-off limited to 
top-level action setters, depth limit default 5, deprecation one release after 
`forward` ships, and Convention's implicit forward carrying no hand-off values.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




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

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

> Add a forward result: server-side transfer to an opted-in action with an 
> explicit hand-off
> ------------------------------------------------------------------------------------------
>
>                 Key: WW-5849
>                 URL: https://issues.apache.org/jira/browse/WW-5849
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Core, Core Interceptors, Plugin - Convention
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.6.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Action chaining (the {{chain}} result plus {{ChainingInterceptor}}) lets one 
> action hand off to another inside the same request, without a round-trip to 
> the browser. Users rely on that: the "Is anyone using action chaining?" 
> thread on user@ showed several applications that use it for server-side 
> branching flows, where the next action depends on the state of the current 
> one.
> Chaining also does much more than that hand-off needs:
> * any action in any namespace can be chained to, and the target name is 
> evaluated as an expression against the value stack
> * {{ChainingInterceptor}} copies every readable property of every object in 
> the value stack onto the target action, by name
> * the source action stays in the value stack below the target
> * the Convention plugin chains implicitly ({{foo}} returning {{bar}} → 
> {{foo-bar}})
> This ticket adds a {{forward}} result that keeps the hand-off and makes both 
> of its boundaries explicit: which actions can be forwarded to, and what data 
> reaches them.
> h2. Behaviour
> # *Static target.* {{actionName}}, {{namespace}} and {{method}} are literal 
> values from configuration; branching uses result codes, one {{forward}} 
> result per branch.
> # *Target-side allowlist.* An action can be forwarded to only if it opts in, 
> with a class-level annotation (not {{@Inherited}}) or an attribute on the 
> {{action}} element. Both are recorded on {{ActionConfig}}. Forwarding to an 
> action that has not opted in throws.
> # *Fresh value stack and own {{ActionContext}}.* The source action is not in 
> the target's value stack; the target's result renders against the target only.
> # *Request parameters are bound again*, like a servlet forward, under the 
> target's own {{@StrutsParameter}} rules.
> # *Explicit hand-off, named on both sides.* The {{forward}} result lists the 
> values it passes (evaluated against the source action); the target marks the 
> properties that accept a forwarded value with a dedicated annotation, 
> separate from {{@StrutsParameter}}. Only values named on both sides are set. 
> In this version: top-level setters on the action only, no nested paths, no 
> ModelDriven model; a value that fails conversion is dropped and logged.
> # *Hand-off is applied after {{params}}* by a dedicated interceptor added 
> directly after {{params}} in the shipped stacks ({{defaultStack}}, 
> {{paramsPrepareParamsStack}}, REST and Bean Validation plugin stacks). A 
> forward that carries values to a target whose stack lacks the interceptor 
> throws.
> # *Action errors, field errors and messages do not carry over* unless passed 
> explicitly.
> # *Depth limit* per request (new constant, default 5) instead of name-based 
> loop detection; exceeding it throws {{StrutsException}}.
> # *The target runs its full interceptor stack.*
> # *Convention:* the implicit {{foo}} → {{foo-bar}} transfer becomes an 
> implicit forward, applied only when {{foo-bar}} has opted in. It carries no 
> hand-off values. {{@Result}} accepts {{type = "forward"}} and its params.
> h2. Configuration
> A new {{struts-7.6.dtd}} adds the opt-in attribute to the {{action}} element. 
> No other grammar change: {{forward}} is a new result type value and the 
> hand-off list uses {{param}} elements.
> h2. Out of scope
> * No change to {{chain}} or {{ChainingInterceptor}} in this ticket; they keep 
> working as today.
> * Deprecating {{chain}} (planned for 7.7.0, together with a log of which 
> properties each chain actually copies, as a migration aid) and removing it in 
> 8.0.0 are separate tickets.
> h2. Docs
> struts-site: a {{forward}} result page (distinguishing it from the 
> {{dispatcher}} result, which forwards to a resource), the opt-in and hand-off 
> annotations, and a {{chain}} → {{forward}} migration guide.



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

Reply via email to