Skip to content

Conversation

@lukaszlenart
Copy link
Member

Summary

Fixes WW-5586 - Enable WithLazyParams interceptors to be configured via interceptor stack parameters.

Problem

Previously, interceptors implementing WithLazyParams could not be configured through interceptor stack parameter syntax because DefaultInterceptorFactory skipped property setting entirely for these interceptors. This prevented configurations like:

<interceptor-ref name="defaultStack">
    <param name="actionFileUpload.allowedTypes">image/png,image/jpeg</param>
    <param name="actionFileUpload.maximumSize">${maxUploadSize}</param>
</interceptor-ref>

Solution

Modified DefaultInterceptorFactory to always set properties during interceptor creation, regardless of WithLazyParams interface implementation. Expression parameters (containing ${...}) are re-evaluated at invocation time via LazyParamInjector, while static parameters remain unchanged.

Changes

  • DefaultInterceptorFactory.java: Removed conditional logic that skipped property setting for WithLazyParams interceptors
  • WithLazyParams.java: Updated JavaDoc to clarify dual initialization behavior (factory time + invocation time)
  • Tests: Added testInvokeWithLazyParamsStackConfiguration() to verify both static and expression parameters work in stacks
  • MockLazyInterceptor: Enhanced to support both static and expression parameters for testing

Testing

  • ✅ All 16 tests in DefaultActionInvocationTest pass
  • ✅ All 33 interceptor-related tests pass
  • ✅ Backward compatibility confirmed - existing expression evaluation still works
  • ✅ New functionality works - static stack parameters now configurable

Benefits

This unblocks WW-5585 and enables combining static security constraints with dynamic expressions in the same interceptor stack reference.

🤖 Generated with Claude Code

Resolves WW-5586

Previously, interceptors implementing WithLazyParams could not be
configured via interceptor stack parameters because DefaultInterceptorFactory
skipped property setting entirely for these interceptors.

Changes:
- DefaultInterceptorFactory: Always set properties for all interceptors
- WithLazyParams: Updated JavaDoc to clarify dual initialization
- Added test for stack parameter configuration with WithLazyParams

Expression parameters are re-evaluated at invocation time via LazyParamInjector,
while static parameters remain unchanged. This enables both static configuration
(e.g., allowedTypes) and dynamic expressions (e.g., ${maxUploadSize}) in the
same interceptor stack reference.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link

@lukaszlenart lukaszlenart changed the title fix(core): enable WithLazyParams interceptor configuration in stacks WW-5586 fix(core): enable WithLazyParams interceptor configuration in stacks Nov 17, 2025
@lukaszlenart lukaszlenart merged commit 6cfd34c into main Nov 17, 2025
9 checks passed
@lukaszlenart lukaszlenart deleted the fix/WW-5586-enable-withlazyparams-stack-configuration branch November 17, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants