You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/11/17 14:25:00 UTC

[jira] [Work logged] (WW-5586) WithLazyParams interceptors cannot be configured within interceptor stacks

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

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

                Author: ASF GitHub Bot
            Created on: 17/Nov/25 14:24
            Start Date: 17/Nov/25 14:24
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart merged PR #1414:
URL: https://github.com/apache/struts/pull/1414




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

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

> WithLazyParams interceptors cannot be configured within interceptor stacks
> --------------------------------------------------------------------------
>
>                 Key: WW-5586
>                 URL: https://issues.apache.org/jira/browse/WW-5586
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.2.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When an interceptor implements WithLazyParams, the DefaultInterceptorFactory skips all property setting during interceptor creation (lines 71-76 in {{DefaultInterceptorFactory.java}}):
> {code:java}
>   if (interceptor instanceof WithLazyParams) {
>       LOG.debug("Interceptor {} is marked with interface {} and params will be set during action invocation",
>               interceptorClassName, WithLazyParams.class.getName());
>   } else {
>       reflectionProvider.setProperties(params, interceptor);
>   }
> {code}
> This breaks the ability to configure such interceptors within interceptor stacks using the standard parameter passing syntax:
> {code:xml}
>   <interceptor-ref name="defaultStack">
>       <param name="actionFileUpload.allowedTypes">${uploadConfig.allowedMimeTypes}</param>
>       <param name="actionFileUpload.allowedExtensions">${uploadConfig.allowedExtensions}</param>
>       <param name="actionFileUpload.maximumSize">${uploadConfig.maxFileSize}</param>
>   </interceptor-ref>
> {code}
> h2. Expected Behavior:
> Interceptors implementing WithLazyParams should support both:
>   1. Static property configuration during factory creation (for backward compatibility)
>   2. Dynamic expression evaluation during action invocation via LazyParamInjector
> h2. Actual Behavior:
> All property setting is skipped during factory creation, preventing any configuration of WithLazyParams interceptors when they're part of an interceptor stack.
> h2. Suggested Fix:
> The factory should always call reflectionProvider.setProperties(params, interceptor) during creation. The LazyParamInjector should then re-evaluate and override properties containing expressions (like ${...}) during action invocation, while leaving static values unchanged.
> h2. Affected Components:
> - DefaultInterceptorFactory.buildInterceptor()
> - Any interceptor implementing WithLazyParams that needs to be configured within stacks
> h2. Workaround:
> Configure the interceptor directly in the action definition instead of modifying it within a stack reference.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)