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 35f471d5861208bf18978e1f6ec3ea3e112b882e Author: Claus Ibsen <[email protected]> AuthorDate: Thu Jun 26 11:36:21 2025 +0200 CAMEL-22200: components that are resource endpoint based should have content cache true as default and make it configurable on component level. --- .../apache/camel/catalog/components/language.json | 23 ++-- .../builder/endpoint/StaticEndpointBuilders.java | 12 +- .../dsl/LanguageEndpointBuilderFactory.java | 138 +++++++++++++-------- 3 files changed, 107 insertions(+), 66 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/language.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/language.json index 41dfb7220d8..3358f330517 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/language.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/language.json @@ -24,22 +24,25 @@ "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 [...] + "allowTemplateFromHeader": { "index": 0, "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 [...] + "contentCache": { "index": 1, "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": 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": { "CamelLanguageScript": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String or Expression", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The script to execute provided in the header. Takes precedence over script configured on the endpoint.", "constantName": "org.apache.camel.component.language.LanguageConstants#LANGUAGE_SCRIPT" } }, "properties": { - "languageName": { "index": 0, "kind": "path", "displayName": "Language Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "bean", "constant", "csimple", "datasonnet", "exchangeProperty", "file", "groovy", "header", "hl7terser", "java", "joor", "jq", "jsonpath", "mvel", "ognl", "ref", "simple", "spel", "sql", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "deprecationNote": "", "autowired": false, [...] + "languageName": { "index": 0, "kind": "path", "displayName": "Language Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "bean", "constant", "csimple", "datasonnet", "exchangeProperty", "file", "groovy", "header", "hl7terser", "java", "joor", "jq", "js", "jsonpath", "mvel", "ognl", "python", "ref", "simple", "spel", "tokenize", "variable", "wasm", "xpath", "xquery", "xtokenize" ], "deprecated": false, "deprecationNo [...] "resourceUri": { "index": 1, "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the resource, or a reference to lookup a bean in the Registry to use as the resource" }, "allowContextMapAll": { "index": 2, "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 [...] - "binary": { "index": 3, "kind": "parameter", "displayName": "Binary", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the script is binary content or text content. By default the script is read as text content (eg java.lang.String)" }, - "cacheScript": { "index": 4, "kind": "parameter", "displayName": "Cache Script", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to cache the compiled script and reuse Notice reusing the script can cause side effects from processing one Camel org.apache.camel.Exchange to the next org.apache.camel.Exchange." }, - "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" }, - "resultType": { "index": 6, "kind": "parameter", "displayName": "Result Type", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, - "script": { "index": 7, "kind": "parameter", "displayName": "Script", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the script to execute" }, - "transform": { "index": 8, "kind": "parameter", "displayName": "Transform", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether or not the result of the script should be used as message body. This options is default true." }, - "lazyStartProducer": { "index": 9, "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 [...] + "allowTemplateFromHeader": { "index": 3, "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 [...] + "contentCache": { "index": 4, "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" }, + "resultType": { "index": 5, "kind": "parameter", "displayName": "Result Type", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "script": { "index": 6, "kind": "parameter", "displayName": "Script", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the script to execute" }, + "transform": { "index": 7, "kind": "parameter", "displayName": "Transform", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether or not the result of the script should be used as message body. This options is default true." }, + "lazyStartProducer": { "index": 8, "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 [...] + "binary": { "index": 9, "kind": "parameter", "displayName": "Binary", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the script is binary content or text content. By default the script is read as text content (eg java.lang.String)" }, + "cacheScript": { "index": 10, "kind": "parameter", "displayName": "Cache Script", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to cache the compiled script and reuse Notice reusing the script can cause side effects from processing one Camel org.apache.camel.Exchange to the next org.apache.camel.Exchange." } } } diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index 9f199bb89f2..7198814d256 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -9688,10 +9688,10 @@ public class StaticEndpointBuilders { * * Path parameter: languageName (required) * Sets the name of the language to use - * There are 23 enums and the value can be one of: bean, constant, csimple, + * There are 26 enums and the value can be one of: bean, constant, csimple, * datasonnet, exchangeProperty, file, groovy, header, hl7terser, java, - * joor, jq, jsonpath, mvel, ognl, ref, simple, spel, sql, tokenize, xpath, - * xquery, xtokenize + * joor, jq, js, jsonpath, mvel, ognl, python, ref, simple, spel, tokenize, + * variable, wasm, xpath, xquery, xtokenize * * Path parameter: resourceUri * Path to the resource, or a reference to lookup a bean in the Registry to @@ -9717,10 +9717,10 @@ public class StaticEndpointBuilders { * * Path parameter: languageName (required) * Sets the name of the language to use - * There are 23 enums and the value can be one of: bean, constant, csimple, + * There are 26 enums and the value can be one of: bean, constant, csimple, * datasonnet, exchangeProperty, file, groovy, header, hl7terser, java, - * joor, jq, jsonpath, mvel, ognl, ref, simple, spel, sql, tokenize, xpath, - * xquery, xtokenize + * joor, jq, js, jsonpath, mvel, ognl, python, ref, simple, spel, tokenize, + * variable, wasm, xpath, xquery, xtokenize * * Path parameter: resourceUri * Path to the resource, or a reference to lookup a bean in the Registry to diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LanguageEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LanguageEndpointBuilderFactory.java index a43fbaf202f..a50048ab55e 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LanguageEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LanguageEndpointBuilderFactory.java @@ -83,69 +83,41 @@ public interface LanguageEndpointBuilderFactory { return this; } /** - * Whether the script is binary content or text content. By default the - * script is read as text content (eg java.lang.String). + * 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 binary the value to set + * @param allowTemplateFromHeader the value to set * @return the dsl builder */ - default LanguageEndpointBuilder binary(boolean binary) { - doSetProperty("binary", binary); + default LanguageEndpointBuilder allowTemplateFromHeader(boolean allowTemplateFromHeader) { + doSetProperty("allowTemplateFromHeader", allowTemplateFromHeader); return this; } /** - * Whether the script is binary content or text content. By default the - * script is read as text content (eg java.lang.String). + * 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 binary the value to set + * @param allowTemplateFromHeader the value to set * @return the dsl builder */ - default LanguageEndpointBuilder binary(String binary) { - doSetProperty("binary", binary); - return this; - } - /** - * Whether to cache the compiled script and reuse Notice reusing the - * script can cause side effects from processing one Camel - * org.apache.camel.Exchange to the next org.apache.camel.Exchange. - * - * The option is a: <code>boolean</code> type. - * - * Default: false - * Group: producer - * - * @param cacheScript the value to set - * @return the dsl builder - */ - default LanguageEndpointBuilder cacheScript(boolean cacheScript) { - doSetProperty("cacheScript", cacheScript); - return this; - } - /** - * Whether to cache the compiled script and reuse Notice reusing the - * script can cause side effects from processing one Camel - * org.apache.camel.Exchange to the next org.apache.camel.Exchange. - * - * The option will be converted to a <code>boolean</code> type. - * - * Default: false - * Group: producer - * - * @param cacheScript the value to set - * @return the dsl builder - */ - default LanguageEndpointBuilder cacheScript(String cacheScript) { - doSetProperty("cacheScript", cacheScript); + default LanguageEndpointBuilder allowTemplateFromHeader(String allowTemplateFromHeader) { + doSetProperty("allowTemplateFromHeader", allowTemplateFromHeader); return this; } /** @@ -296,6 +268,72 @@ public interface LanguageEndpointBuilderFactory { doSetProperty("lazyStartProducer", lazyStartProducer); return this; } + /** + * Whether the script is binary content or text content. By default the + * script is read as text content (eg java.lang.String). + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: advanced + * + * @param binary the value to set + * @return the dsl builder + */ + default AdvancedLanguageEndpointBuilder binary(boolean binary) { + doSetProperty("binary", binary); + return this; + } + /** + * Whether the script is binary content or text content. By default the + * script is read as text content (eg java.lang.String). + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: advanced + * + * @param binary the value to set + * @return the dsl builder + */ + default AdvancedLanguageEndpointBuilder binary(String binary) { + doSetProperty("binary", binary); + return this; + } + /** + * Whether to cache the compiled script and reuse Notice reusing the + * script can cause side effects from processing one Camel + * org.apache.camel.Exchange to the next org.apache.camel.Exchange. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: advanced + * + * @param cacheScript the value to set + * @return the dsl builder + */ + default AdvancedLanguageEndpointBuilder cacheScript(boolean cacheScript) { + doSetProperty("cacheScript", cacheScript); + return this; + } + /** + * Whether to cache the compiled script and reuse Notice reusing the + * script can cause side effects from processing one Camel + * org.apache.camel.Exchange to the next org.apache.camel.Exchange. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: advanced + * + * @param cacheScript the value to set + * @return the dsl builder + */ + default AdvancedLanguageEndpointBuilder cacheScript(String cacheScript) { + doSetProperty("cacheScript", cacheScript); + return this; + } } public interface LanguageBuilders { @@ -324,10 +362,10 @@ public interface LanguageEndpointBuilderFactory { * * Path parameter: languageName (required) * Sets the name of the language to use - * There are 23 enums and the value can be one of: bean, constant, + * There are 26 enums and the value can be one of: bean, constant, * csimple, datasonnet, exchangeProperty, file, groovy, header, - * hl7terser, java, joor, jq, jsonpath, mvel, ognl, ref, simple, spel, - * sql, tokenize, xpath, xquery, xtokenize + * hl7terser, java, joor, jq, js, jsonpath, mvel, ognl, python, ref, + * simple, spel, tokenize, variable, wasm, xpath, xquery, xtokenize * * Path parameter: resourceUri * Path to the resource, or a reference to lookup a bean in the Registry @@ -353,10 +391,10 @@ public interface LanguageEndpointBuilderFactory { * * Path parameter: languageName (required) * Sets the name of the language to use - * There are 23 enums and the value can be one of: bean, constant, + * There are 26 enums and the value can be one of: bean, constant, * csimple, datasonnet, exchangeProperty, file, groovy, header, - * hl7terser, java, joor, jq, jsonpath, mvel, ognl, ref, simple, spel, - * sql, tokenize, xpath, xquery, xtokenize + * hl7terser, java, joor, jq, js, jsonpath, mvel, ognl, python, ref, + * simple, spel, tokenize, variable, wasm, xpath, xquery, xtokenize * * Path parameter: resourceUri * Path to the resource, or a reference to lookup a bean in the Registry
