Repository navigation
Conversation
…g reads
The header is documented as "The ServletContext for a web application",
but no code in the component looks it up. The web application template
resolver is built from the endpoint's jakartaServletWebApplication
field:
WebApplicationTemplateResolver resolver
= new WebApplicationTemplateResolver(jakartaServletWebApplication);
which is set by setJakartaServletWebApplication, and nothing else in the
component touches a ServletContext at all - thymeleaf 3.1 dropped the
ServletContext-based web context in favour of
IWebApplication/JakartaServletWebApplication, which is what the resolver
takes now.
Deprecate the constant with a note pointing at the setter.
gnodet-bot
left a comment
There was a problem hiding this comment.
LGTM overall — the analysis in the PR description is correct and the fix is minimal. One missing piece before this is ready.
Missing upgrade guide entry. AGENTS.md requires that any deprecation be documented in the upgrade guide. The header CamelThymeleafServletContext is deprecated in this PR but camel-4x-upgrade-guide-4_24.adoc has no entry for it. Other header deprecations in this release (e.g. CamelGoogleVertexAIChatMessages, CamelNeo4jLabel, STS2Constants.SECRET_KEY_ID) all have upgrade guide entries following the same pattern. Please add one — something like:
=== camel-thymeleaf - CamelThymeleafServletContext header is deprecated
The `CamelThymeleafServletContext` header constant is deprecated. It was never read by the component: since Thymeleaf 3.1 the web application template resolver is built from the `jakartaServletWebApplication` set on the endpoint, not from a `ServletContext` passed as a header. Setting this header has been silently ignored since the component was introduced. Use the `jakartaServletWebApplication` endpoint option instead.This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
Thanks! I confirmed THYMELEAF_SERVLET_CONTEXT is never read on main, nor in 4.4.0/4.10.0, and the WEB_APP resolver is built from jakartaServletWebApplication. Deprecation makes sense.
- The generated description reads
"The ServletContext for a web application.. Deprecation note: ..."(both JSON files). The generator only adds a '.' when the description does not already end with one, so it would write a single period; this looks hand-edited and CI's regen check will probably differ. Could you regenerate it with the build? ThymeleafEndpointBuilderFactory(dsl/camel-endpointdsl/src/generated/...,thymeleafServletContext()) also needs regenerating, as in #29709.- Please add a short entry to
camel-4x-upgrade-guide-4_24.adoc. - [Suggestion]
jakartaServletWebApplicationis not a URI option, onlyThymeleafEndpoint.setJakartaServletWebApplication(...). The note atThymeleafConstants.java:36-40could say that, so users know where to set it.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
✅ Generated files are up to dateAn earlier CI run reported uncommitted generated changes; the latest run no longer does. |
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the regen commit addresses the mechanical pieces. One issue remains.
What was addressed:
- ✅
@Deprecatedadded toThymeleafConstants.THYMELEAF_SERVLET_CONTEXT - ✅
deprecationNoteset correctly in@Metadata - ✅ Both catalog JSON files regenerated:
deprecated: trueanddeprecationNotepresent - ✅
ThymeleafEndpointBuilderFactory.thymeleafServletContext()regenerated with@Deprecated
Still open: upgrade guide entry missing
camel-4x-upgrade-guide-4_24.adoc has not been updated. Every header deprecation in this release cycle has a corresponding upgrade guide entry (see e.g. CamelNeo4jLabel, CamelGoogleVertexAIChatMessages). Please add one, e.g.:
=== camel-thymeleaf - CamelThymeleafServletContext header is deprecated
The `CamelThymeleafServletContext` header constant is deprecated. It was never read by the component: since Thymeleaf 3.1 the web application template resolver is built from the `jakartaServletWebApplication` set on the endpoint (via `ThymeleafEndpoint.setJakartaServletWebApplication(...)`), not from a `ServletContext` passed as a header. Setting this header has been silently ignored. Use the `jakartaServletWebApplication` endpoint option instead.Note: jakartaServletWebApplication is not a URI option — it must be set programmatically on ThymeleafEndpoint (this also addresses davsclaus's point 4 from the previous review).
This review was generated by an AI agent, Hermès on behalf of @gnodet.
davsclaus
left a comment
There was a problem hiding this comment.
Thanks, the Regen commit fixed the doubled period in both thymeleaf.json files and added @Deprecated to thymeleafServletContext() in ThymeleafEndpointBuilderFactory, so those points are done.
- Please add a short entry for the deprecated
CamelThymeleafServletContextheader todocs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc. - [Suggestion]
ThymeleafConstants.java:37-38:jakartaServletWebApplicationis not a URI option; it is set withThymeleafEndpoint.setJakartaServletWebApplication(...). Naming that setter in the note would tell users where to set it (the JSON files and the endpoint DSL then need regenerating again).
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 of 726 tested, 24 compile-only — current: 9 all testedMaveniverse Scalpel detected 9 affected modules (current approach: 9). Skip-tests mode would test 9 modules (4 direct + 8 downstream), skip tests for 24 (generated code, meta-modules) Modules Scalpel would test (9)
Modules with tests skipped (24)
All tested modules (36 modules, 5m 13s total)Total reactor time: 5m 13s
Top 20 slowest modules:
|
…ade note jakartaServletWebApplication is a plain field on ThymeleafEndpoint, not a URI option, so "set on the endpoint" left users looking for a URI parameter. The note now names ThymeleafEndpoint.setJakartaServletWebApplication and says it is not a URI option, and the 4.24 upgrade guide shows the call. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Both done, thanks.
|
# Conflicts: # docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
davsclaus
left a comment
There was a problem hiding this comment.
Thanks @Dhairya-007, the note now names ThymeleafEndpoint.setJakartaServletWebApplication and says it is not a URI option. Both thymeleaf.json files and ThymeleafEndpointBuilderFactory are regenerated to match, and the upgrade guide has an entry. One fix to the example in that entry:
camel-4x-upgrade-guide-4_24.adoc:8912:thymeleaf:greeting.htmluses the default resolver,CLASS_LOADER(ThymeleafEndpoint.java:73). TheJakartaServletWebApplicationis only used withresolver=WEB_APP(ThymeleafEndpoint.java:298-299), so as written the example sets an object that is never read. Something like:
ThymeleafEndpoint endpoint = context.getEndpoint("thymeleaf:greeting.html?resolver=WEB_APP", ThymeleafEndpoint.class);
endpoint.setJakartaServletWebApplication(
JakartaServletWebApplication.buildApplication(servletContext));The route must use the same URI (to("thymeleaf:greeting.html?resolver=WEB_APP")) to get this endpoint, and the setter must be called before the first message, because the template engine is built on first use.
2. [Suggestion, optional] Same section, :8901-8907: users do not need the internal new WebApplicationTemplateResolver(...) line, and "gets no error and no resolver" is unclear. For example: "The header is never read: with resolver=WEB_APP the templates are resolved from the JakartaServletWebApplication set on the endpoint, and a route that sets the header gets no error and no effect."
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
…te-servlet-context-header # Conflicts: # docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the upgrade guide entry has been added and the setter is now named. One issue in the entry's code example remains open.
Upgrade guide example uses wrong URI (thymeleaf:greeting.html instead of thymeleaf:greeting.html?resolver=WEB_APP)
ThymeleafEndpoint.java:73 sets the default resolver to CLASS_LOADER. The WEB_APP resolver (and therefore JakartaServletWebApplication) is only activated when resolver=WEB_APP is passed (ThymeleafEndpoint.java:298-299). As written, the example calls setJakartaServletWebApplication(...) on a CLASS_LOADER endpoint — the object is set but never read by the component, defeating the purpose of the example. davsclaus already flagged this in the previous round; it has not been fixed in the new commits.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
…4.adoc Co-authored-by: Guillaume Nodet - AI Bot <gnodet+bot@gmail.com>
gnodet-bot
left a comment
There was a problem hiding this comment.
The last blocker is fixed: the upgrade guide example now uses thymeleaf:greeting.html?resolver=WEB_APP, which correctly activates the WEB_APP resolver and therefore makes the setJakartaServletWebApplication(...) call meaningful.
Summary of what was done in this PR:
- ✅
THYMELEAF_SERVLET_CONTEXTconstant annotated@Deprecatedwith adeprecationNote - ✅ Both catalog
thymeleaf.jsonfiles regenerated withdeprecated: trueanddeprecationNote - ✅
ThymeleafEndpointBuilderFactory.thymeleafServletContext()regenerated with@Deprecatedand updated javadoc - ✅ Upgrade guide entry added explaining why the header is deprecated and how to migrate
Good catch and clean fix.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
davsclaus
left a comment
There was a problem hiding this comment.
Thanks @Dhairya-007. The upgrade-guide example now uses thymeleaf:greeting.html?resolver=WEB_APP, so setJakartaServletWebApplication(...) sets the object the WEB_APP resolver reads. That was the last open point; the generated files and the deprecation note were already in order. I approved the CI runs on this head.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
Problem
ThymeleafConstantspublishes a header that the component never looks up:CamelThymeleafServletContextappears nowhere else in the component - not inThymeleafEndpoint,ThymeleafProducerorThymeleafComponent, and not in a test. The component does not handle aServletContextanywhere; theWebApplicationTemplateResolveris built from a field on the endpoint instead:which
setJakartaServletWebApplicationfills in.That matches the Thymeleaf 3.1 API: the
ServletContext-based web context was replaced byIWebApplication/JakartaServletWebApplication, andWebApplicationTemplateResolvertakes the latter. So the header has nothing it could be passed to any more - setting it is silently ignored, while the catalog lists it as a supported header with ajakarta.servlet.ServletContexttype.Fix
Deprecate the constant with a
deprecationNotepointing atjakartaServletWebApplication, so the catalog stops advertising it. The constant stays, so nothing stops compiling.The regenerated
thymeleaf.jsonfiles are included.