This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 667178783135 camel-thymeleaf: deprecate CamelThymeleafServletContext, 
which nothing reads (#29956)
667178783135 is described below

commit 6671787831351d1b4a69affdf9e5e730f90dc094
Author: dhairya05 <[email protected]>
AuthorDate: Sun Nov 15 22:46:40 2026 +0530

    camel-thymeleaf: deprecate CamelThymeleafServletContext, which nothing 
reads (#29956)
    
    Co-authored-by: Guillaume Nodet - AI Bot <[email protected]>
    Co-Authored-By: Claude Opus 5 <[email protected]>
---
 .../apache/camel/catalog/components/thymeleaf.json   |  2 +-
 .../apache/camel/component/thymeleaf/thymeleaf.json  |  2 +-
 .../component/thymeleaf/ThymeleafConstants.java      |  6 +++++-
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc      | 20 ++++++++++++++++++++
 .../dsl/ThymeleafEndpointBuilderFactory.java         |  7 ++++++-
 5 files changed, 33 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 9cf7b1fc30cb..af197b722477 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<String, Object>", "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. [...]
-    "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 given to 
ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", 
"autowired": false, "secret": false, "description": "The Servlet [...]
   },
   "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 9cf7b1fc30cb..af197b722477 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<String, Object>", "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. [...]
-    "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 given to 
ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI option", 
"autowired": false, "secret": false, "description": "The Servlet [...]
   },
   "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 796db9ca9bf6..39e27bc57b95 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,11 @@ public class ThymeleafConstants {
               javaType = "Map<String, Object>")
     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 given to 
ThymeleafEndpoint.setJakartaServletWebApplication,"
+                                + " which is not a URI option")
+    @Deprecated
     public static final String THYMELEAF_SERVLET_CONTEXT = 
"CamelThymeleafServletContext";
 
     private ThymeleafConstants() {
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 5139905f9578..6c7fa1cce202 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
@@ -9017,3 +9017,23 @@ two matching headers, `CamelDockerLoggingFilter` and 
`CamelDockerFollowRedirectF
 Both options and both header constants are now deprecated. Remove 
`loggingFilter` and `followRedirectFilter` from the
 endpoint URI or the component configuration; setting them has changed nothing 
since 2.18. To see the traffic with the
 Docker daemon, raise the log level of the `com.github.dockerjava` loggers.
+
+=== 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?resolver=WEB_APP", 
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 c33d3b6e4682..6c7b96a5c320 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,11 @@ public interface ThymeleafEndpointBuilderFactory {
             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 given to
+         * ThymeleafEndpoint.setJakartaServletWebApplication, which is not a 
URI
+         * option.
          * 
          * The option is a: {@code jakarta.servlet.ServletContext} type.
          * 
@@ -518,6 +522,7 @@ public interface ThymeleafEndpointBuilderFactory {
          * 
          * @return the name of the header {@code ThymeleafServletContext}.
          */
+        @Deprecated
         public String thymeleafServletContext() {
             return "CamelThymeleafServletContext";
         }

Reply via email to