This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch re in repository https://gitbox.apache.org/repos/asf/camel.git
commit 7c5cbc53f8179a72328e5e9663d5ab3a23b38e43 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Jun 26 14:24:50 2025 +0200 CAMEL-22200: components that are resource endpoint based should have content cache true as default and make it configurable on component level. --- .../camel/catalog/components/string-template.json | 5 +- .../apache/camel/catalog/components/thymeleaf.json | 14 +++-- .../apache/camel/catalog/components/velocity.json | 7 ++- .../camel/component/chunk/ChunkComponent.java | 6 +- .../component/freemarker/FreemarkerComponent.java | 2 +- .../apache/camel/component/jolt/JoltComponent.java | 4 +- .../apache/camel/component/jslt/JsltComponent.java | 4 +- .../component/jsonpatch/JsonPatchComponent.java | 4 +- .../jsonvalidator/JsonValidatorComponent.java | 2 +- .../camel/component/jsonata/JsonataComponent.java | 4 +- .../apache/camel/component/jte/JteComponent.java | 2 +- .../component/language/LanguageComponent.java | 4 +- .../component/mustache/MustacheComponent.java | 13 ++++- .../apache/camel/component/mvel/MvelComponent.java | 2 +- .../stringtemplate/StringTemplateComponent.java | 2 +- .../dsl/ThymeleafEndpointBuilderFactory.java | 68 ++++++++++++---------- 16 files changed, 82 insertions(+), 61 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/string-template.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/string-template.json index 8bb992d3a57..7d502750dbf 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/string-template.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/string-template.json @@ -26,8 +26,9 @@ "componentProperties": { "allowContextMapAll": { "index": 0, "kind": "property", "displayName": "Allow Context Map All", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether the context map should allow access to all details. By default only the message body and headers can be accessed. This option can be enabled for full access to the current Exchange and Ca [...] "allowTemplateFromHeader": { "index": 1, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential se [...] - "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] - "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + "contentCache": { "index": 2, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, + "lazyStartProducer": { "index": 3, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] + "autowiredEnabled": { "index": 4, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { "CamelStringTemplateResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A URI for the template resource to use instead of the endpoint configured.", "constantName": "org.apache.camel.component.stringtemplate.StringTemplateConstants#STRINGTEMPLATE_RESOURCE_URI" }, 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 72b13e00181..5e3b6ae1d4e 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 @@ -24,8 +24,10 @@ "remote": false }, "componentProperties": { - "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] - "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + "allowContextMapAll": { "index": 0, "kind": "property", "displayName": "Allow Context Map All", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether the context map should allow access to all details. By default only the message body and headers can be accessed. This option can be enabled for full access to the current Exchange and Ca [...] + "allowTemplateFromHeader": { "index": 1, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential se [...] + "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] + "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { "CamelThymeleafResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the Thymeleaf template.", "constantName": "org.apache.camel.component.thymeleaf.ThymeleafConstants#THYMELEAF_RESOURCE_URI" }, @@ -36,10 +38,10 @@ "properties": { "resourceUri": { "index": 0, "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will look [...] "allowContextMapAll": { "index": 1, "kind": "parameter", "displayName": "Allow Context Map All", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether the context map should allow access to all details. By default only the message body and headers can be accessed. This option can be enabled for full access to the current Exchange and C [...] - "cacheable": { "index": 2, "kind": "parameter", "displayName": "Cacheable", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "description": "Whether templates have to be considered cacheable or not." }, - "cacheTimeToLive": { "index": 3, "kind": "parameter", "displayName": "Cache Time To Live", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "description": "The cache Time To Live for templates, expressed in milliseconds." }, - "checkExistence": { "index": 4, "kind": "parameter", "displayName": "Check Existence", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "description": "Whether a template resources will be checked for existence before being returned." }, - "contentCache": { "index": 5, "kind": "parameter", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, + "allowTemplateFromHeader": { "index": 2, "kind": "parameter", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential s [...] + "cacheable": { "index": 3, "kind": "parameter", "displayName": "Cacheable", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "description": "Whether templates have to be considered cacheable or not." }, + "cacheTimeToLive": { "index": 4, "kind": "parameter", "displayName": "Cache Time To Live", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "description": "The cache Time To Live for templates, expressed in milliseconds." }, + "checkExistence": { "index": 5, "kind": "parameter", "displayName": "Check Existence", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "description": "Whether a template resources will be checked for existence before being returned." }, "templateMode": { "index": 6, "kind": "parameter", "displayName": "Template Mode", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "HTML", "XML", "TEXT", "JAVASCRIPT", "CSS", "RAW" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTML", "description": "The template mode to be applied to templates." }, "lazyStartProducer": { "index": 7, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] "encoding": { "index": 8, "kind": "parameter", "displayName": "Encoding", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The character encoding to be used for reading template resources." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/velocity.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/velocity.json index dcd7590efc5..d3fbb8ae517 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/velocity.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/velocity.json @@ -26,9 +26,10 @@ "componentProperties": { "allowContextMapAll": { "index": 0, "kind": "property", "displayName": "Allow Context Map All", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether the context map should allow access to all details. By default only the message body and headers can be accessed. This option can be enabled for full access to the current Exchange and Ca [...] "allowTemplateFromHeader": { "index": 1, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential se [...] - "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] - "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] - "velocityEngine": { "index": 4, "kind": "property", "displayName": "Velocity Engine", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.velocity.app.VelocityEngine", "deprecated": false, "autowired": false, "secret": false, "description": "To use the VelocityEngine otherwise a new engine is created" } + "contentCache": { "index": 2, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, + "lazyStartProducer": { "index": 3, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] + "autowiredEnabled": { "index": 4, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + "velocityEngine": { "index": 5, "kind": "property", "displayName": "Velocity Engine", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.velocity.app.VelocityEngine", "deprecated": false, "autowired": true, "secret": false, "description": "To use the VelocityEngine otherwise a new engine is created" } }, "headers": { "CamelVelocityResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the velocity template.", "constantName": "org.apache.camel.component.velocity.VelocityConstants#VELOCITY_RESOURCE_URI" }, diff --git a/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkComponent.java b/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkComponent.java index 514cdb7cff4..9ff6b70d09b 100644 --- a/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkComponent.java +++ b/components/camel-chunk/src/main/java/org/apache/camel/component/chunk/ChunkComponent.java @@ -27,10 +27,10 @@ import org.apache.camel.support.DefaultComponent; public class ChunkComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; - @Metadata(defaultValue = "false") + @Metadata private boolean allowContextMapAll; public ChunkComponent() { diff --git a/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java b/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java index e91a1ef5541..95acefa2c6b 100644 --- a/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java +++ b/components/camel-freemarker/src/main/java/org/apache/camel/component/freemarker/FreemarkerComponent.java @@ -36,7 +36,7 @@ import org.apache.camel.util.ObjectHelper; public class FreemarkerComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata private boolean allowTemplateFromHeader; @Metadata diff --git a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java index 6c0b283f042..b0bca688829 100644 --- a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java +++ b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java @@ -29,8 +29,8 @@ import org.apache.camel.support.ResourceHelper; public class JoltComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; @Metadata(label = "advanced") private Transform transform; diff --git a/components/camel-jslt/src/main/java/org/apache/camel/component/jslt/JsltComponent.java b/components/camel-jslt/src/main/java/org/apache/camel/component/jslt/JsltComponent.java index 30363b4c548..ccd4ef53e80 100644 --- a/components/camel-jslt/src/main/java/org/apache/camel/component/jslt/JsltComponent.java +++ b/components/camel-jslt/src/main/java/org/apache/camel/component/jslt/JsltComponent.java @@ -31,8 +31,8 @@ import org.apache.camel.support.ResourceHelper; public class JsltComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; @Metadata(label = "advanced") private Collection<Function> functions; diff --git a/components/camel-json-patch/src/main/java/org/apache/camel/component/jsonpatch/JsonPatchComponent.java b/components/camel-json-patch/src/main/java/org/apache/camel/component/jsonpatch/JsonPatchComponent.java index 6c1a4fb0bd6..835beb804d9 100644 --- a/components/camel-json-patch/src/main/java/org/apache/camel/component/jsonpatch/JsonPatchComponent.java +++ b/components/camel-json-patch/src/main/java/org/apache/camel/component/jsonpatch/JsonPatchComponent.java @@ -26,8 +26,8 @@ import org.apache.camel.support.DefaultComponent; public class JsonPatchComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { diff --git a/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorComponent.java b/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorComponent.java index 4ba9a2f7f56..687ed5bfe71 100644 --- a/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorComponent.java +++ b/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorComponent.java @@ -32,7 +32,7 @@ import org.apache.camel.support.DefaultComponent; public class JsonValidatorComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata(defaultValue = "true") private boolean useDefaultObjectMapper = true; @Metadata(label = "advanced") diff --git a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataComponent.java b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataComponent.java index d3449fac41f..7599ff74ca3 100644 --- a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataComponent.java +++ b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataComponent.java @@ -28,8 +28,8 @@ import org.apache.camel.support.ResourceHelper; public class JsonataComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; @Metadata(label = "advanced", description = "To configure custom frame bindings and inject user functions.") diff --git a/components/camel-jte/src/main/java/org/apache/camel/component/jte/JteComponent.java b/components/camel-jte/src/main/java/org/apache/camel/component/jte/JteComponent.java index 9237871ef9c..a3dce7a2d61 100644 --- a/components/camel-jte/src/main/java/org/apache/camel/component/jte/JteComponent.java +++ b/components/camel-jte/src/main/java/org/apache/camel/component/jte/JteComponent.java @@ -44,7 +44,7 @@ public class JteComponent extends DefaultComponent { @Metadata(defaultValue = "Plain") private ContentType contentType = ContentType.Plain; @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata private boolean allowTemplateFromHeader; @Metadata diff --git a/components/camel-language/src/main/java/org/apache/camel/component/language/LanguageComponent.java b/components/camel-language/src/main/java/org/apache/camel/component/language/LanguageComponent.java index 969f64acfab..08cc0c3fe8d 100644 --- a/components/camel-language/src/main/java/org/apache/camel/component/language/LanguageComponent.java +++ b/components/camel-language/src/main/java/org/apache/camel/component/language/LanguageComponent.java @@ -37,8 +37,8 @@ public class LanguageComponent extends DefaultComponent { public static final String RESOURCE = "resource:"; @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; - @Metadata(defaultValue = "false") + private boolean contentCache = true; + @Metadata private boolean allowTemplateFromHeader; public LanguageComponent() { diff --git a/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheComponent.java b/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheComponent.java index 57c539e47aa..b65772b696f 100644 --- a/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheComponent.java +++ b/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheComponent.java @@ -37,17 +37,26 @@ import org.apache.camel.support.DefaultComponent; public class MustacheComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata private boolean allowTemplateFromHeader; @Metadata private boolean allowContextMapAll; @Metadata(label = "advanced", autowired = true) - private MustacheFactory mustacheFactory = new DefaultMustacheFactory(); + private MustacheFactory mustacheFactory; public MustacheComponent() { } + @Override + protected void doInit() throws Exception { + super.doInit(); + + if (mustacheFactory == null) { + mustacheFactory = new DefaultMustacheFactory(); + } + } + @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { MustacheEndpoint endpoint = new MustacheEndpoint(uri, this, remaining); diff --git a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelComponent.java b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelComponent.java index 77b58762554..89c8527b9b5 100644 --- a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelComponent.java +++ b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelComponent.java @@ -31,7 +31,7 @@ import org.apache.camel.support.ResourceHelper; public class MvelComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata private boolean allowTemplateFromHeader; @Metadata diff --git a/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java b/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java index 8801cf051d7..a634e48501f 100644 --- a/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java +++ b/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java @@ -28,7 +28,7 @@ import org.apache.camel.support.ResourceHelper; public class StringTemplateComponent extends DefaultComponent { @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") - private boolean contentCache; + private boolean contentCache = true; @Metadata private boolean allowTemplateFromHeader; @Metadata 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 44022bb00dd..86a1e22a791 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 @@ -82,6 +82,44 @@ public interface ThymeleafEndpointBuilderFactory { doSetProperty("allowContextMapAll", allowContextMapAll); return this; } + /** + * Whether to allow to use resource template from header or not (default + * false). Enabling this allows to specify dynamic templates via message + * header. However this can be seen as a potential security + * vulnerability if the header is coming from a malicious user, so use + * this with care. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param allowTemplateFromHeader the value to set + * @return the dsl builder + */ + default ThymeleafEndpointBuilder allowTemplateFromHeader(boolean allowTemplateFromHeader) { + doSetProperty("allowTemplateFromHeader", allowTemplateFromHeader); + return this; + } + /** + * Whether to allow to use resource template from header or not (default + * false). Enabling this allows to specify dynamic templates via message + * header. However this can be seen as a potential security + * vulnerability if the header is coming from a malicious user, so use + * this with care. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param allowTemplateFromHeader the value to set + * @return the dsl builder + */ + default ThymeleafEndpointBuilder allowTemplateFromHeader(String allowTemplateFromHeader) { + doSetProperty("allowTemplateFromHeader", allowTemplateFromHeader); + return this; + } /** * Whether templates have to be considered cacheable or not. * @@ -170,36 +208,6 @@ public interface ThymeleafEndpointBuilderFactory { doSetProperty("checkExistence", checkExistence); return this; } - /** - * Sets whether to use resource content cache or not. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: producer - * - * @param contentCache the value to set - * @return the dsl builder - */ - default ThymeleafEndpointBuilder contentCache(boolean contentCache) { - doSetProperty("contentCache", contentCache); - return this; - } - /** - * Sets whether to use resource content cache or not. - * - * The option will be converted to a <code>boolean</code> type. - * - * Default: true - * Group: producer - * - * @param contentCache the value to set - * @return the dsl builder - */ - default ThymeleafEndpointBuilder contentCache(String contentCache) { - doSetProperty("contentCache", contentCache); - return this; - } /** * The template mode to be applied to templates. *
