Skip to content

WW-5713 refactor(tiles): resolve the legacy OGNL flag from the container's own ServletContext - #1961

Merged
lukaszlenart merged 2 commits into
mainfrom
WW-5713-factory-servlet-context
Sep 17, 2026
Merged

lukaszlenart merged 2 commits into
mainfrom
WW-5713-factory-servlet-context

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Follow-up to #1890, addressing the two non-blocking review notes on it.

Fixes WW-5713

What changed

Flag lookup keyed to the container's own web application. The lazy OGNL: evaluator read struts.tiles.ognl.legacy.enabled from the ServletContext of whichever Tiles Request reached it first — walking the request wrappers and catching NotAServletEnvironmentException. A Tiles container is built for exactly one ApplicationContext, so the factory now captures that context's ServletContext at construction (ServletUtil.getServletContext) and resolves Dispatcher.getInstance(servletContext) against it. isLegacyOgnlEnabled(ServletContext) replaces isLegacyOgnlEnabled(Request); request objects no longer participate in the decision. A non-servlet ApplicationContext cannot carry a Dispatcher and gets the disabled evaluator outright, with no lookup.

Removal version dropped from Javadoc, messages and README. @Deprecated(since = "7.4.0", forRemoval = true) and WW-5714 already track the removal; the text no longer promises a release number.

Tests

  • nonServletApplicationContextFailsClosedWithoutLookup — mock ApplicationContext → disabled, zero configuration resolutions, zero raw-evaluator constructions.
  • flagIsReadFromTheOwningWebApplicationNotFromTheRequest — factory built for a web application with the flag false, evaluated with a request from a neighbouring ServletContext whose flag is true → still disabled.
  • Existing lazy/concurrency/once-per-lifecycle tests re-pointed at a ServletApplicationContext; noArgInitializerPreservesLazyWebApplicationConfiguration now configures the flag on the factory's own context, since the request no longer carries it.

Tiles module: 565 run, 0 failures. Security review of the diff: clean — the captured context is always the registering application's own (StrutsTilesListenerStrutsTilesInitializerBasicTilesContainerFactory.createContainer), and the raw evaluator plus the OgnlRuntime.setPropertyAccessor mutation remain reachable only through an explicit true.

🤖 Generated with Claude Code

…ner's own ServletContext

The lazy OGNL: evaluator read struts.tiles.ognl.legacy.enabled from the
ServletContext of whichever Tiles Request reached it first, walking the
request wrappers and catching NotAServletEnvironmentException. The Tiles
container is built for exactly one ApplicationContext, so capture that
context's ServletContext at construction and key the Dispatcher lookup to
it. A non-servlet ApplicationContext cannot carry a Dispatcher and now gets
the disabled evaluator outright.

Removal-version mentions are dropped from the Javadoc, the runtime
messages and the README; forRemoval = true and WW-5714 track the removal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ows lambda

Sonar S5778 on nonServletApplicationContextFailsClosedWithoutLookup.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit e213ef6 into main Sep 17, 2026
13 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5713-factory-servlet-context branch September 17, 2026 05:50
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.

1 participant