From 2d1276e8c28773dabb2f2a7999d1527176ca4ac4 Mon Sep 17 00:00:00 2001 From: dhairya05 Date: Sat, 14 Nov 2026 23:50:18 +0530 Subject: [PATCH 1/4] camel-thymeleaf: deprecate CamelThymeleafServletContext, which nothing 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. --- .../org/apache/camel/catalog/components/thymeleaf.json | 2 +- .../org/apache/camel/component/thymeleaf/thymeleaf.json | 2 +- .../apache/camel/component/thymeleaf/ThymeleafConstants.java | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json index 9cf7b1fc30cb6..b8dfb7285e6b6 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": false, "autowired": false, "secret": false, "description": "The ServletContext for a web application.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application.. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json index 9cf7b1fc30cb6..b8dfb7285e6b6 100644 --- a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json +++ b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": false, "autowired": false, "secret": false, "description": "The ServletContext for a web application.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application.. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java b/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java index 796db9ca9bf67..bd12869e404aa 100644 --- a/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java +++ b/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java @@ -33,7 +33,10 @@ public class ThymeleafConstants { javaType = "Map") public static final String THYMELEAF_VARIABLE_MAP = "CamelThymeleafVariableMap"; - @Metadata(description = "The ServletContext for a web application.", javaType = "jakarta.servlet.ServletContext") + @Metadata(description = "The ServletContext for a web application.", javaType = "jakarta.servlet.ServletContext", + deprecationNote = "Never read by the component: the web application template resolver is built from the" + + " jakartaServletWebApplication set on the endpoint") + @Deprecated public static final String THYMELEAF_SERVLET_CONTEXT = "CamelThymeleafServletContext"; private ThymeleafConstants() { From 5a6053847373465069ba6d402d95c1c7054cce90 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Sat, 14 Nov 2026 19:07:50 +0000 Subject: [PATCH 2/4] Regen --- .../org/apache/camel/catalog/components/thymeleaf.json | 2 +- .../org/apache/camel/component/thymeleaf/thymeleaf.json | 2 +- .../endpoint/dsl/ThymeleafEndpointBuilderFactory.java | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json index b8dfb7285e6b6..d8ea8bd09d64b 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application.. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json index b8dfb7285e6b6..d8ea8bd09d64b 100644 --- a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json +++ b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application.. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java index c33d3b6e4682e..30db411196325 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java @@ -510,7 +510,9 @@ public String thymeleafVariableMap() { return "CamelThymeleafVariableMap"; } /** - * The ServletContext for a web application. + * The ServletContext for a web application. Deprecation note: Never + * read by the component: the web application template resolver is built + * from the jakartaServletWebApplication set on the endpoint. * * The option is a: {@code jakarta.servlet.ServletContext} type. * @@ -518,6 +520,7 @@ public String thymeleafVariableMap() { * * @return the name of the header {@code ThymeleafServletContext}. */ + @Deprecated public String thymeleafServletContext() { return "CamelThymeleafServletContext"; } From 2e4004749ed938e425969de2d8c554ebdd0c9144 Mon Sep 17 00:00:00 2001 From: dhairya05 Date: Sun, 15 Nov 2026 15:16:54 +0530 Subject: [PATCH 3/4] camel-thymeleaf: name the setter in the deprecation note, add an upgrade 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 --- .../camel/catalog/components/thymeleaf.json | 2 +- .../camel/component/thymeleaf/thymeleaf.json | 2 +- .../thymeleaf/ThymeleafConstants.java | 3 ++- .../pages/camel-4x-upgrade-guide-4_24.adoc | 20 +++++++++++++++++++ .../dsl/ThymeleafEndpointBuilderFactory.java | 4 +++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json index d8ea8bd09d64b..af197b7224771 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the JakartaServletWebApplication given to ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the JakartaServletWebApplication given to ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json index d8ea8bd09d64b..af197b7224771 100644 --- a/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json +++ b/components/camel-thymeleaf/src/generated/resources/META-INF/org/apache/camel/component/thymeleaf/thymeleaf.json @@ -33,7 +33,7 @@ "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, "CamelThymeleafTemplate": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The content of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_TEMPLATE" }, "CamelThymeleafVariableMap": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map", "deprecated": false, "autowired": false, "secret": false, "description": "The value of this header should be a Map with key\/values that will be override any existing key with the same name. This can be used to preconfigure common key\/values you want to reuse in your Thymeleaf endpoints.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_VARIABLE_MAP" }, - "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the jakartaServletWebApplication set on the endpoint", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } + "CamelThymeleafServletContext": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "jakarta.servlet.ServletContext", "deprecated": true, "deprecationNote": "Never read by the component: the web application template resolver is built from the JakartaServletWebApplication given to ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", "autowired": false, "secret": false, "description": "The ServletContext for a web application. Deprecation note: Never read by the component: the web application template resolver is built from the JakartaServletWebApplication given to ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_SERVLET_CONTEXT" } }, "bodyTypes": { "producerIn": { "carriers": [ "any" ], "description": "The template gets the body as ${body}, as it is: text, or a Map, a List or a POJO to read from; no body prints as empty text, and bytes or a stream are not read as text. The template is the resource, or the CamelThymeleafTemplate header with allowTemplateFromHeader=true, never the body" }, diff --git a/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java b/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java index bd12869e404aa..39e27bc57b954 100644 --- a/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java +++ b/components/camel-thymeleaf/src/main/java/org/apache/camel/component/thymeleaf/ThymeleafConstants.java @@ -35,7 +35,8 @@ public class ThymeleafConstants { @Metadata(description = "The ServletContext for a web application.", javaType = "jakarta.servlet.ServletContext", deprecationNote = "Never read by the component: the web application template resolver is built from the" - + " jakartaServletWebApplication set on the endpoint") + + " JakartaServletWebApplication given to ThymeleafEndpoint.setJakartaServletWebApplication," + + " which is not a URI option") @Deprecated public static final String THYMELEAF_SERVLET_CONTEXT = "CamelThymeleafServletContext"; diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 028422a474ff9..a2eca125b1d1a 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -8743,3 +8743,23 @@ if it configured the proxy. It is now deprecated, with a `deprecationNote` that says so, and its description no longer claims to configure a proxy. Remove `protocol` from the endpoint URI or the configuration. To send the client's traffic through a proxy, use `proxyProtocol` together with `proxyHost` and `proxyPort`, which the shared client builder does apply. + +=== camel-thymeleaf - the CamelThymeleafServletContext header is deprecated + +The `CamelThymeleafServletContext` header is never read by the component. The web application template resolver is +built from a `JakartaServletWebApplication`, not from a `ServletContext`, and that object comes from the endpoint: + +[source,java] +---- +WebApplicationTemplateResolver resolver = new WebApplicationTemplateResolver(jakartaServletWebApplication); +---- + +A route that sets the header gets no error and no resolver. It is now deprecated, with a `deprecationNote` that says +so. `jakartaServletWebApplication` is not a URI option; set it on the endpoint: + +[source,java] +---- +ThymeleafEndpoint endpoint = context.getEndpoint("thymeleaf:greeting.html", ThymeleafEndpoint.class); +endpoint.setJakartaServletWebApplication( + JakartaServletWebApplication.buildApplication(servletContext)); +---- diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java index 30db411196325..6c7b96a5c3200 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ThymeleafEndpointBuilderFactory.java @@ -512,7 +512,9 @@ public String thymeleafVariableMap() { /** * The ServletContext for a web application. Deprecation note: Never * read by the component: the web application template resolver is built - * from the jakartaServletWebApplication set on the endpoint. + * from the JakartaServletWebApplication given to + * ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI + * option. * * The option is a: {@code jakarta.servlet.ServletContext} type. * From deadd2f65ab83f4ff63de315f929e52b63936246 Mon Sep 17 00:00:00 2001 From: dhairya05 <83921853+Dhairya-007@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:38:43 +0530 Subject: [PATCH 4/4] Update docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc Co-authored-by: Guillaume Nodet - AI Bot --- .../modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 3ccb6fedac531..0e16c4bfda6f8 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -8981,7 +8981,7 @@ so. `jakartaServletWebApplication` is not a URI option; set it on the endpoint: [source,java] ---- -ThymeleafEndpoint endpoint = context.getEndpoint("thymeleaf:greeting.html", ThymeleafEndpoint.class); +ThymeleafEndpoint endpoint = context.getEndpoint("thymeleaf:greeting.html?resolver=WEB_APP", ThymeleafEndpoint.class); endpoint.setJakartaServletWebApplication( JakartaServletWebApplication.buildApplication(servletContext)); ----