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..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": 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 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 9cf7b1fc30cb6..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": 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 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 796db9ca9bf67..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 @@ -33,7 +33,11 @@ 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 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 d07f463c80fc0..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 @@ -8965,3 +8965,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 c33d3b6e4682e..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 @@ -510,7 +510,11 @@ 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 given to + * ThymeleafEndpoint.setJakartaServletWebApplication, which is not a URI + * option. * * The option is a: {@code jakarta.servlet.ServletContext} type. * @@ -518,6 +522,7 @@ public String thymeleafVariableMap() { * * @return the name of the header {@code ThymeleafServletContext}. */ + @Deprecated public String thymeleafServletContext() { return "CamelThymeleafServletContext"; }