This is an automated email from the ASF dual-hosted git repository.
Croway 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 499eb3858dc4 CAMEL-27079: camel-core - a dumped
removeHeaders/removeProperties keeps the Java exclude patterns, and
excludePattern is described as one pattern (#30238)
499eb3858dc4 is described below
commit 499eb3858dc43ab57eb5c6409f8f8094f2e39e12
Author: Federico Mariani <[email protected]>
AuthorDate: Tue Nov 17 13:22:17 2026 +0100
CAMEL-27079: camel-core - a dumped removeHeaders/removeProperties keeps the
Java exclude patterns, and excludePattern is described as one pattern (#30238)
* CAMEL-27079: camel-core - a dumped removeHeaders/removeProperties keeps
the Java exclude patterns, and excludePattern is described as one pattern
- The excludePattern description no longer says a comma separates patterns:
it is one pattern (exact,
wildcard or regular expression), and several are kept with a regular
expression such as header1|header3.
- The exclude patterns given in Java (removeHeaders("*", "a", "b")) are
also kept in excludePattern,
combined by PatternHelper.combinePatterns into one pattern that matches
the same names, so a route dumped
as XML or YAML keeps them. The Java route still runs with the patterns as
given.
- The Remove Headers and Remove Properties EIP pages show how to keep
several headers or properties.
* Regen
* CAMEL-27079: camel-support, camel-java-io - a combined wildcard keeps
both its readings, and a Java dump writes the exclude patterns as given
---------
Co-authored-by: Guillaume Nodet <[email protected]>
---
.../camel/catalog/docs/removeHeaders-eip.adoc | 49 ++++++++
.../camel/catalog/docs/removeProperties-eip.adoc | 46 ++++++++
.../apache/camel/catalog/models/removeHeaders.json | 2 +-
.../camel/catalog/models/removeProperties.json | 2 +-
.../apache/camel/catalog/schemas/camel-spring.xsd | 6 +-
.../apache/camel/catalog/schemas/camel-xml-io.xsd | 6 +-
.../camel/catalog/schemas/camelYamlDsl-model.json | 4 +-
.../docs/modules/eips/pages/removeHeaders-eip.adoc | 49 ++++++++
.../modules/eips/pages/removeProperties-eip.adoc | 46 ++++++++
.../org/apache/camel/model/removeHeaders.json | 2 +-
.../org/apache/camel/model/removeProperties.json | 2 +-
.../camel/model/RemoveHeadersDefinition.java | 6 +-
.../camel/model/RemovePropertiesDefinition.java | 6 +-
.../DumpModelRemoveHeadersExcludePatternsTest.java | 125 +++++++++++++++++++++
.../org/apache/camel/java/in/ModelNormalizer.java | 11 --
.../camel/java/out/JavaDslModelWriterSupport.java | 9 +-
.../apache/camel/java/LwModelToJavaDumperTest.java | 23 ++++
.../org/apache/camel/support/PatternHelper.java | 72 ++++++++++++
.../apache/camel/support/PatternHelperTest.java | 39 +++++++
.../dsl/jbang/core/commands/ai/eip-samples.json | 8 ++
.../dsl/yaml/deserializers/ModelDeserializers.java | 4 +-
.../resources/schema/camelYamlDsl-canonical.json | 4 +-
.../resources/schema/camelYamlDsl-model.json | 4 +-
.../generated/resources/schema/camelYamlDsl.json | 4 +-
24 files changed, 494 insertions(+), 35 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeaders-eip.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeaders-eip.adoc
index 06159cb31fcb..7ff2f0810419 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeaders-eip.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeaders-eip.adoc
@@ -111,6 +111,55 @@ YAML::
----
====
+== Keeping some headers
+
+The `excludePattern` option keeps the headers it matches, with the same rules
as `pattern`.
+It is a single pattern: to keep several headers, use a regular expression with
`|` (a comma does not separate patterns).
+In Java, you can also give several exclude patterns as arguments.
+
+The following removes all headers, except `header1`, `header3` and the headers
that start with `Camel`:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("seda:b")
+ .removeHeaders("*", "header1", "header3", "Camel*")
+ .to("mock:result");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="seda:b"/>
+ <removeHeaders pattern="*" excludePattern="header1|header3|Camel.*"/>
+ <to uri="mock:result"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: seda:b
+ steps:
+ - removeHeaders:
+ pattern: "*"
+ excludePattern: "header1|header3|Camel.*"
+ - to:
+ uri: mock:result
+----
+====
+
+NOTE: Inside a regular expression, `Camel*` means `Came` followed by any
number of `l`: use `Camel.*` to match the headers
+that start with `Camel`.
+
== Leaking Camel headers when sending to an endpoint
When I send a message to a Camel endpoint such as the
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeProperties-eip.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeProperties-eip.adoc
index 1bbb83305819..7c0a44ffdc78 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeProperties-eip.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeProperties-eip.adoc
@@ -116,6 +116,52 @@ YAML::
----
====
+== Keeping some properties
+
+The `excludePattern` option keeps the exchange properties it matches, with the
same rules as `pattern`.
+It is a single pattern: to keep several properties, use a regular expression
with `|` (a comma does not separate patterns).
+In Java, you can also give several exclude patterns as arguments.
+
+The following removes the exchange properties that start with `Foo`, except
`FooKeep` and `FooToo`:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("seda:b")
+ .removeProperties("Foo*", "FooKeep", "FooToo")
+ .to("mock:result");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="seda:b"/>
+ <removeProperties pattern="Foo*" excludePattern="FooKeep|FooToo"/>
+ <to uri="mock:result"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: seda:b
+ steps:
+ - removeProperties:
+ pattern: "Foo*"
+ excludePattern: "FooKeep|FooToo"
+ - to:
+ uri: mock:result
+----
+====
+
== See Also
Camel provides the following EIPs for removing headers or exchange properties:
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeHeaders.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeHeaders.json
index 5dbf9a968445..17d1336677ec 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeHeaders.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeHeaders.json
@@ -17,7 +17,7 @@
"description": { "index": 2, "kind": "attribute", "displayName":
"Description", "group": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The description for this node" },
"disabled": { "index": 3, "kind": "attribute", "displayName": "Disabled",
"group": "advanced", "label": "advanced", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to disable this
EIP from the route during build time. Once an EIP has been disabled then it
cannot be enabled later at runtime." },
"pattern": { "index": 4, "kind": "attribute", "displayName": "Pattern",
"group": "common", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name or pattern of headers to remove. The pattern supports
exact match, wildcard (pattern ends with *), and regular expression (all
case-insensitive)." },
- "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of headers
to not remove. You can use comma to separate multiple patterns." }
+ "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of headers
to not remove. The pattern supports exact match, wildcard (pattern ends with
*), and regular expression (all case-insensitive). To keep several headers, use
a regular expression such as hea [...]
},
"bodyTypes": {
"eipOut": { "carriers": [ "unchanged" ], "description": "Removes headers:
the body stays as it was" }
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeProperties.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeProperties.json
index 72717ef0b8ef..abd7c66f3030 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeProperties.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/removeProperties.json
@@ -17,7 +17,7 @@
"description": { "index": 2, "kind": "attribute", "displayName":
"Description", "group": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The description for this node" },
"disabled": { "index": 3, "kind": "attribute", "displayName": "Disabled",
"group": "advanced", "label": "advanced", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to disable this
EIP from the route during build time. Once an EIP has been disabled then it
cannot be enabled later at runtime." },
"pattern": { "index": 4, "kind": "attribute", "displayName": "Pattern",
"group": "common", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name or pattern of properties to remove. Supports exact match,
wildcard (ending with *), and regular expression (all case-insensitive)." },
- "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of
properties to not remove. You can use comma to separate multiple patterns." }
+ "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of
properties to not remove. Supports exact match, wildcard (ending with *), and
regular expression (all case-insensitive). To keep several properties, use a
regular expression such as prop1|prop3." }
},
"bodyTypes": {
"eipOut": { "carriers": [ "unchanged" ], "description": "Removes exchange
properties: the body stays as it was" }
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 9c232fc4d45b..1aeaab236396 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -12181,7 +12181,8 @@ expression (all case-insensitive).
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Name or pattern of headers to not remove. You can use comma to separate
multiple patterns.
+Name or pattern of headers to not remove. The pattern supports exact match,
wildcard (pattern ends with *), and regular
+expression (all case-insensitive). To keep several headers, use a regular
expression such as header1|header3.
]]>
</xs:documentation>
</xs:annotation>
@@ -12207,7 +12208,8 @@ case-insensitive).
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Name or pattern of properties to not remove. You can use comma to separate
multiple patterns.
+Name or pattern of properties to not remove. Supports exact match, wildcard
(ending with *), and regular expression (all
+case-insensitive). To keep several properties, use a regular expression such
as prop1|prop3.
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
index 2f5a8b2e0a3f..4423ec15b2ce 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
@@ -11321,7 +11321,8 @@ expression (all case-insensitive).
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Name or pattern of headers to not remove. You can use comma to separate
multiple patterns.
+Name or pattern of headers to not remove. The pattern supports exact match,
wildcard (pattern ends with *), and regular
+expression (all case-insensitive). To keep several headers, use a regular
expression such as header1|header3.
]]>
</xs:documentation>
</xs:annotation>
@@ -11347,7 +11348,8 @@ case-insensitive).
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Name or pattern of properties to not remove. You can use comma to separate
multiple patterns.
+Name or pattern of properties to not remove. Supports exact match, wildcard
(ending with *), and regular expression (all
+case-insensitive). To keep several properties, use a regular expression such
as prop1|prop3.
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
index 79029270856b..058d06ae0284 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
@@ -5991,7 +5991,7 @@
}, {
"name" : "excludePattern",
"type" : "string",
- "description" : "Name or pattern of headers to not remove. You can use
comma to separate multiple patterns.",
+ "description" : "Name or pattern of headers to not remove. The pattern
supports exact match, wildcard (pattern ends with *), and regular expression
(all case-insensitive). To keep several headers, use a regular expression such
as header1|header3.",
"title" : "Exclude Pattern",
"displayName" : "Exclude Pattern",
"kind" : "attribute",
@@ -6057,7 +6057,7 @@
}, {
"name" : "excludePattern",
"type" : "string",
- "description" : "Name or pattern of properties to not remove. You can
use comma to separate multiple patterns.",
+ "description" : "Name or pattern of properties to not remove. Supports
exact match, wildcard (ending with *), and regular expression (all
case-insensitive). To keep several properties, use a regular expression such as
prop1|prop3.",
"title" : "Exclude Pattern",
"displayName" : "Exclude Pattern",
"kind" : "attribute",
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc
index 06159cb31fcb..7ff2f0810419 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc
@@ -111,6 +111,55 @@ YAML::
----
====
+== Keeping some headers
+
+The `excludePattern` option keeps the headers it matches, with the same rules
as `pattern`.
+It is a single pattern: to keep several headers, use a regular expression with
`|` (a comma does not separate patterns).
+In Java, you can also give several exclude patterns as arguments.
+
+The following removes all headers, except `header1`, `header3` and the headers
that start with `Camel`:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("seda:b")
+ .removeHeaders("*", "header1", "header3", "Camel*")
+ .to("mock:result");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="seda:b"/>
+ <removeHeaders pattern="*" excludePattern="header1|header3|Camel.*"/>
+ <to uri="mock:result"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: seda:b
+ steps:
+ - removeHeaders:
+ pattern: "*"
+ excludePattern: "header1|header3|Camel.*"
+ - to:
+ uri: mock:result
+----
+====
+
+NOTE: Inside a regular expression, `Camel*` means `Came` followed by any
number of `l`: use `Camel.*` to match the headers
+that start with `Camel`.
+
== Leaking Camel headers when sending to an endpoint
When I send a message to a Camel endpoint such as the
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc
index 1bbb83305819..7c0a44ffdc78 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc
@@ -116,6 +116,52 @@ YAML::
----
====
+== Keeping some properties
+
+The `excludePattern` option keeps the exchange properties it matches, with the
same rules as `pattern`.
+It is a single pattern: to keep several properties, use a regular expression
with `|` (a comma does not separate patterns).
+In Java, you can also give several exclude patterns as arguments.
+
+The following removes the exchange properties that start with `Foo`, except
`FooKeep` and `FooToo`:
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("seda:b")
+ .removeProperties("Foo*", "FooKeep", "FooToo")
+ .to("mock:result");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="seda:b"/>
+ <removeProperties pattern="Foo*" excludePattern="FooKeep|FooToo"/>
+ <to uri="mock:result"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: seda:b
+ steps:
+ - removeProperties:
+ pattern: "Foo*"
+ excludePattern: "FooKeep|FooToo"
+ - to:
+ uri: mock:result
+----
+====
+
== See Also
Camel provides the following EIPs for removing headers or exchange properties:
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeHeaders.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeHeaders.json
index 5dbf9a968445..17d1336677ec 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeHeaders.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeHeaders.json
@@ -17,7 +17,7 @@
"description": { "index": 2, "kind": "attribute", "displayName":
"Description", "group": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The description for this node" },
"disabled": { "index": 3, "kind": "attribute", "displayName": "Disabled",
"group": "advanced", "label": "advanced", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to disable this
EIP from the route during build time. Once an EIP has been disabled then it
cannot be enabled later at runtime." },
"pattern": { "index": 4, "kind": "attribute", "displayName": "Pattern",
"group": "common", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name or pattern of headers to remove. The pattern supports
exact match, wildcard (pattern ends with *), and regular expression (all
case-insensitive)." },
- "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of headers
to not remove. You can use comma to separate multiple patterns." }
+ "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of headers
to not remove. The pattern supports exact match, wildcard (pattern ends with
*), and regular expression (all case-insensitive). To keep several headers, use
a regular expression such as hea [...]
},
"bodyTypes": {
"eipOut": { "carriers": [ "unchanged" ], "description": "Removes headers:
the body stays as it was" }
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeProperties.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeProperties.json
index 72717ef0b8ef..abd7c66f3030 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeProperties.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/removeProperties.json
@@ -17,7 +17,7 @@
"description": { "index": 2, "kind": "attribute", "displayName":
"Description", "group": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The description for this node" },
"disabled": { "index": 3, "kind": "attribute", "displayName": "Disabled",
"group": "advanced", "label": "advanced", "required": false, "type": "boolean",
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether to disable this
EIP from the route during build time. Once an EIP has been disabled then it
cannot be enabled later at runtime." },
"pattern": { "index": 4, "kind": "attribute", "displayName": "Pattern",
"group": "common", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Name or pattern of properties to remove. Supports exact match,
wildcard (ending with *), and regular expression (all case-insensitive)." },
- "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of
properties to not remove. You can use comma to separate multiple patterns." }
+ "excludePattern": { "index": 5, "kind": "attribute", "displayName":
"Exclude Pattern", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Name or pattern of
properties to not remove. Supports exact match, wildcard (ending with *), and
regular expression (all case-insensitive). To keep several properties, use a
regular expression such as prop1|prop3." }
},
"bodyTypes": {
"eipOut": { "carriers": [ "unchanged" ], "description": "Removes exchange
properties: the body stays as it was" }
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/RemoveHeadersDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/RemoveHeadersDefinition.java
index d8f273384e7f..fe27cd84e116 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/RemoveHeadersDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/RemoveHeadersDefinition.java
@@ -27,6 +27,7 @@ import org.apache.camel.spi.BodyType.Carrier;
import org.apache.camel.spi.BodyTypes;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.DslArg;
+import org.apache.camel.support.PatternHelper;
/**
* Removes message headers whose name matches a specified pattern
@@ -52,7 +53,8 @@ public class RemoveHeadersDefinition extends
NoOutputDefinition<RemoveHeadersDef
private String pattern;
@XmlAttribute
@Metadata(label = "advanced",
- description = "Name or pattern of headers to not remove. You can
use comma to separate multiple patterns.")
+ description = "Name or pattern of headers to not remove. The
pattern supports exact match, wildcard (pattern ends with *), and regular
expression (all case-insensitive)."
+ + " To keep several headers, use a regular
expression such as header1|header3.")
private String excludePattern;
public RemoveHeadersDefinition() {
@@ -108,6 +110,8 @@ public class RemoveHeadersDefinition extends
NoOutputDefinition<RemoveHeadersDef
public void setExcludePatterns(String[] excludePatterns) {
this.excludePatterns = excludePatterns;
+ // XML and YAML have only the excludePattern option: it holds them
too, so a dumped route keeps them
+ this.excludePattern = PatternHelper.combinePatterns(excludePatterns);
}
public String getExcludePattern() {
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/RemovePropertiesDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/RemovePropertiesDefinition.java
index 94e7ea90160f..875211a6338f 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/RemovePropertiesDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/RemovePropertiesDefinition.java
@@ -27,6 +27,7 @@ import org.apache.camel.spi.BodyType.Carrier;
import org.apache.camel.spi.BodyTypes;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.DslArg;
+import org.apache.camel.support.PatternHelper;
/**
* Removes message exchange properties whose name matches a specified pattern
@@ -50,7 +51,8 @@ public class RemovePropertiesDefinition extends
NoOutputDefinition<RemovePropert
private String pattern;
@XmlAttribute
@Metadata(label = "advanced",
- description = "Name or pattern of properties to not remove. You
can use comma to separate multiple patterns.")
+ description = "Name or pattern of properties to not remove.
Supports exact match, wildcard (ending with *), and regular expression (all
case-insensitive)."
+ + " To keep several properties, use a regular
expression such as prop1|prop3.")
private String excludePattern;
public RemovePropertiesDefinition() {
@@ -106,6 +108,8 @@ public class RemovePropertiesDefinition extends
NoOutputDefinition<RemovePropert
public void setExcludePatterns(String[] excludePatterns) {
this.excludePatterns = excludePatterns;
+ // XML and YAML have only the excludePattern option: it holds them
too, so a dumped route keeps them
+ this.excludePattern = PatternHelper.combinePatterns(excludePatterns);
}
public String getExcludePattern() {
diff --git
a/core/camel-core/src/test/java/org/apache/camel/util/DumpModelRemoveHeadersExcludePatternsTest.java
b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelRemoveHeadersExcludePatternsTest.java
new file mode 100644
index 000000000000..63429abdf740
--- /dev/null
+++
b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelRemoveHeadersExcludePatternsTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.util;
+
+import java.io.StringReader;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.support.PluginHelper;
+import org.apache.camel.xml.in.ModelParser;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The exclude patterns given to removeHeaders and removeProperties in Java
are dumped in the excludePattern option, so
+ * the dumped route keeps the same headers and properties.
+ */
+public class DumpModelRemoveHeadersExcludePatternsTest extends
ContextTestSupport {
+
+ private static final Map<String, Object> HEADERS = Map.of("header1", "a",
"header2", "b", "CamelFoo", "c",
+ "BeerHeineken", "d", "BeerCarlsberg", "e", "org.acme.id", "f");
+
+ @Test
+ public void testDumpModelAsXml() throws Exception {
+ assertThat(xml("one")).contains("pattern=\"*\"
excludePattern=\"keep\"/>");
+ assertThat(xml("headers"))
+ .contains("pattern=\"*\"
excludePattern=\"header1|Camel.*|(?:Camel*)|(?:Beer(Heineken|Tuborg))"
+ + "|\\Qorg.acme\\E.*|(?:org.acme*)\"/>");
+ assertThat(xml("properties")).contains("pattern=\"p*\"
excludePattern=\"p1|p3\"/>");
+ }
+
+ @Test
+ public void testDumpModelAsYaml() throws Exception {
+ assertThat(yaml("one")).contains("excludePattern: keep");
+ assertThat(yaml("headers")).contains(
+ "excludePattern:
header1|Camel.*|(?:Camel*)|(?:Beer(Heineken|Tuborg))|\\Qorg.acme\\E.*|(?:org.acme*)");
+ assertThat(yaml("properties")).contains("excludePattern: p1|p3");
+ }
+
+ @Test
+ public void testDumpedRoutesKeepTheSameHeadersAndProperties() throws
Exception {
+ assertKept(context, template);
+
+ RoutesDefinition dumped = new RoutesDefinition();
+ for (String id : new String[] { "headers", "properties" }) {
+ dumped.getRoutes().addAll(new ModelParser(new
StringReader(xml(id))).parseRoutesDefinition().orElseThrow()
+ .getRoutes());
+ }
+ try (CamelContext other = new DefaultCamelContext()) {
+ ((ModelCamelContext)
other).addRouteDefinitions(dumped.getRoutes());
+ other.start();
+ assertKept(other, other.createProducerTemplate());
+ }
+ }
+
+ private static void assertKept(CamelContext camelContext, ProducerTemplate
producer) throws Exception {
+ MockEndpoint headers = camelContext.getEndpoint("mock:headers",
MockEndpoint.class);
+ headers.expectedMessageCount(1);
+ MockEndpoint properties = camelContext.getEndpoint("mock:properties",
MockEndpoint.class);
+ properties.expectedMessageCount(1);
+
+ producer.sendBodyAndHeaders("direct:headers", "Hello", HEADERS);
+ producer.sendBody("direct:properties", "Hello");
+ MockEndpoint.assertIsSatisfied(camelContext);
+
+
assertThat(headers.getReceivedExchanges().get(0).getMessage().getHeaders())
+ .containsOnlyKeys("header1", "CamelFoo", "BeerHeineken",
"org.acme.id");
+ Exchange exchange = properties.getReceivedExchanges().get(0);
+ assertThat(exchange.getProperties()).containsKeys("p1",
"p3").doesNotContainKey("p2");
+ }
+
+ private String xml(String routeId) throws Exception {
+ return
PluginHelper.getModelToXMLDumper(context).dumpModelAsXml(context,
context.getRouteDefinition(routeId));
+ }
+
+ private String yaml(String routeId) throws Exception {
+ return
PluginHelper.getModelToYAMLDumper(context).dumpModelAsYaml(context,
context.getRouteDefinition(routeId));
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:one").routeId("one")
+ .removeHeaders("*", "keep")
+ .to("mock:one");
+
+ from("direct:headers").routeId("headers")
+ .removeHeaders("*", "header1", "Camel*",
"Beer(Heineken|Tuborg)", "org.acme*")
+ .to("mock:headers");
+
+ from("direct:properties").routeId("properties")
+ .setProperty("p1", constant("a"))
+ .setProperty("p2", constant("b"))
+ .setProperty("p3", constant("c"))
+ .removeProperties("p*", "p1", "p3")
+ .to("mock:properties");
+ }
+ };
+ }
+}
diff --git
a/core/camel-java-io/src/main/java/org/apache/camel/java/in/ModelNormalizer.java
b/core/camel-java-io/src/main/java/org/apache/camel/java/in/ModelNormalizer.java
index 680ea1d07ae3..477c13e8ec4b 100644
---
a/core/camel-java-io/src/main/java/org/apache/camel/java/in/ModelNormalizer.java
+++
b/core/camel-java-io/src/main/java/org/apache/camel/java/in/ModelNormalizer.java
@@ -27,8 +27,6 @@ import java.util.Map;
import java.util.Set;
import org.apache.camel.builder.ExpressionClause;
-import org.apache.camel.model.RemoveHeadersDefinition;
-import org.apache.camel.model.RemovePropertiesDefinition;
import org.apache.camel.model.language.ConstantExpression;
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.support.builder.ValueBuilder;
@@ -74,15 +72,6 @@ final class ModelNormalizer {
if (!o.getClass().getName().startsWith("org.apache.camel.model.")) {
return;
}
- // removeHeaders("*", "keep") keeps one exclude in an array, XML and
YAML in the excludePattern option
- if (o instanceof RemoveHeadersDefinition rh && rh.getExcludePattern()
== null && rh.getExcludePatterns() != null
- && rh.getExcludePatterns().length == 1) {
- rh.setExcludePattern(rh.getExcludePatterns()[0]);
- }
- if (o instanceof RemovePropertiesDefinition rp &&
rp.getExcludePattern() == null
- && rp.getExcludePatterns() != null &&
rp.getExcludePatterns().length == 1) {
- rp.setExcludePattern(rp.getExcludePatterns()[0]);
- }
if (o instanceof ConstantExpression ce && ce.getExpression() == null
&& ce.getExpressionValue() != null) {
// expression().constant(value) keeps the value as a runtime
expression; the other DSLs have its text
ce.setExpression(ce.getExpressionValue().toString());
diff --git
a/core/camel-java-io/src/main/java/org/apache/camel/java/out/JavaDslModelWriterSupport.java
b/core/camel-java-io/src/main/java/org/apache/camel/java/out/JavaDslModelWriterSupport.java
index 259ff3780570..e5fb8d41c21c 100644
---
a/core/camel-java-io/src/main/java/org/apache/camel/java/out/JavaDslModelWriterSupport.java
+++
b/core/camel-java-io/src/main/java/org/apache/camel/java/out/JavaDslModelWriterSupport.java
@@ -757,11 +757,12 @@ public abstract class JavaDslModelWriterSupport {
String call = null;
if (def instanceof ThrowExceptionDefinition t && t.getExceptionType()
== null && t.getExceptionClass() != null) {
call = "throwException(" + typeName(t.getExceptionClass()) +
".class, " + quote(t.getMessage()) + ")";
- } else if (def instanceof RemoveHeadersDefinition r &&
r.getExcludePattern() == null
- && r.getExcludePatterns() != null &&
r.getExcludePatterns().length > 0) {
+ } else if (def instanceof RemoveHeadersDefinition r &&
r.getExcludePatterns() != null
+ && r.getExcludePatterns().length > 0) {
+ // the patterns as given, not the excludePattern that combines
them for XML and YAML
call = "removeHeaders(" + quote(r.getPattern()) + ", " +
quotedList(r.getExcludePatterns()) + ")";
- } else if (def instanceof RemovePropertiesDefinition r &&
r.getExcludePattern() == null
- && r.getExcludePatterns() != null &&
r.getExcludePatterns().length > 0) {
+ } else if (def instanceof RemovePropertiesDefinition r &&
r.getExcludePatterns() != null
+ && r.getExcludePatterns().length > 0) {
call = "removeProperties(" + quote(r.getPattern()) + ", " +
quotedList(r.getExcludePatterns()) + ")";
}
if (call == null || stepStart < 0 || stepStart >= sb.length()) {
diff --git
a/core/camel-java-io/src/test/java/org/apache/camel/java/LwModelToJavaDumperTest.java
b/core/camel-java-io/src/test/java/org/apache/camel/java/LwModelToJavaDumperTest.java
index 30a766f6d674..d9d5b368ec7a 100644
---
a/core/camel-java-io/src/test/java/org/apache/camel/java/LwModelToJavaDumperTest.java
+++
b/core/camel-java-io/src/test/java/org/apache/camel/java/LwModelToJavaDumperTest.java
@@ -156,6 +156,29 @@ public class LwModelToJavaDumperTest {
}
}
+ /**
+ * The exclude patterns given in Java are written as arguments again, not
as the single excludePattern that holds
+ * them for XML and YAML.
+ */
+ @Test
+ public void testDumpSeveralExcludePatterns() throws Exception {
+ try (DefaultCamelContext context = new DefaultCamelContext()) {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start").routeId("excludes")
+ .removeHeaders("*", "header1", "Camel*",
"{{keep}}")
+ .removeProperties("p*", "p1", "p3")
+ .to("mock:result");
+ }
+ });
+ String java = new LwModelToJavaDumper().dumpModelAsJava(context,
context.getRouteDefinition("excludes"));
+ assertThat(java).contains(
+ ".removeHeaders(\"*\", \"header1\", \"Camel*\",
\"{{keep}}\")",
+ ".removeProperties(\"p*\", \"p1\", \"p3\")");
+ }
+ }
+
/**
* An option set to its documented default value is written: when it is
not set, the option takes the value of a
* parent level (the rest configuration for a verb, the error handler for
the redelivery of an onException).
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/PatternHelper.java
b/core/camel-support/src/main/java/org/apache/camel/support/PatternHelper.java
index a58c36e93ee3..be5d10abd3b9 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/PatternHelper.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/PatternHelper.java
@@ -16,10 +16,14 @@
*/
package org.apache.camel.support;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
+import java.util.StringJoiner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -211,6 +215,74 @@ public final class PatternHelper {
return false;
}
+ /**
+ * Combines several patterns into one pattern, which {@link
#matchPattern(String, String)} matches when any of the
+ * patterns matches. This is how options that hold a single pattern, such
as the excludePattern of removeHeaders,
+ * keep several patterns.
+ * <p>
+ * A single pattern is returned as it is. Several patterns are joined with
| into one regular expression: a name
+ * stays as it is, a regular expression is put in a group, and a pattern
that is not a valid regular expression is
+ * quoted, so it keeps its exact or wildcard match. matchPattern reads a
wildcard (text ending with a *) also as a
+ * regular expression, so a wildcard keeps both: Camel* becomes
Camel.*|(?:Camel*), which matches CamelFoo and Came,
+ * and my.app* becomes \Qmy.app\E.*|(?:my.app*), which matches my.app.id.
A wildcard such as kafka.* stays one
+ * regular expression, which already matches every name that starts with
kafka.
+ * <p>
+ * Two readings are not kept. A regular expression no longer matches its
own text as an exact name: a+b matches aab,
+ * not the name a+b. A property placeholder is combined before it is
resolved: {{keep}} is quoted, so it keeps the
+ * exact name it resolves to, and {{keep}}* the names that start with it,
but not a wildcard or a regular expression
+ * it resolves to.
+ *
+ * @param patterns the patterns, <code>null</code> elements are ignored
+ * @return the combined pattern, or <code>null</code> if there is
no pattern
+ */
+ public static String combinePatterns(String... patterns) {
+ if (patterns == null) {
+ return null;
+ }
+ List<String> list =
Arrays.stream(patterns).filter(Objects::nonNull).toList();
+ if (list.size() <= 1) {
+ return list.isEmpty() ? null : list.get(0);
+ }
+ StringJoiner answer = new StringJoiner("|");
+ for (String pattern : list) {
+ answer.add(asRegex(pattern));
+ }
+ return answer.toString();
+ }
+
+ private static String asRegex(String pattern) {
+ if (!pattern.endsWith("*")) {
+ if (!hasRegexChars(pattern)) {
+ return pattern;
+ }
+ return isRegex(pattern) ? "(?:" + pattern + ")" :
Pattern.quote(pattern);
+ }
+ String text = pattern.substring(0, pattern.length() - 1);
+ String wildcard = (hasRegexChars(text) ? Pattern.quote(text) : text) +
".*";
+ if (text.isEmpty() || !isRegex(pattern)) {
+ return wildcard;
+ }
+ String head = text.substring(0, text.length() - 1);
+ if (text.endsWith(".") && matchRegex(head, head)) {
+ // head.* matches every name that starts with head, so the names
that start with head. too
+ return "(?:" + pattern + ")";
+ }
+ return wildcard + "|(?:" + pattern + ")";
+ }
+
+ private static boolean hasRegexChars(String text) {
+ return text.chars().anyMatch(c -> REGEX_METACHARS.indexOf(c) >= 0);
+ }
+
+ private static boolean isRegex(String pattern) {
+ try {
+ Pattern.compile(pattern);
+ return true;
+ } catch (PatternSyntaxException e) {
+ return false;
+ }
+ }
+
public static boolean isExcludePatternMatch(String key, String...
excludePatterns) {
for (String pattern : excludePatterns) {
if (matchPattern(key, pattern)) {
diff --git
a/core/camel-support/src/test/java/org/apache/camel/support/PatternHelperTest.java
b/core/camel-support/src/test/java/org/apache/camel/support/PatternHelperTest.java
index 53911b77f1bb..3fc18d78119c 100644
---
a/core/camel-support/src/test/java/org/apache/camel/support/PatternHelperTest.java
+++
b/core/camel-support/src/test/java/org/apache/camel/support/PatternHelperTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.support;
+import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -24,6 +25,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PatternHelperTest {
@@ -144,6 +146,43 @@ class PatternHelperTest {
}
}
+ @Test
+ void testCombinePatterns() {
+ assertNull(PatternHelper.combinePatterns());
+ assertNull(PatternHelper.combinePatterns((String[]) null));
+ assertNull(PatternHelper.combinePatterns(null, null));
+ assertEquals("Camel*", PatternHelper.combinePatterns("Camel*"));
+ assertEquals("Camel*", PatternHelper.combinePatterns(null, "Camel*"));
+ assertEquals("header1|header3",
PatternHelper.combinePatterns("header1", "header3"));
+
assertEquals("header1|Camel.*|(?:Camel*)|(?:Beer(Heineken|Tuborg))|\\Q*File\\E.*|\\Qa(\\E",
+ PatternHelper.combinePatterns("header1", "Camel*",
"Beer(Heineken|Tuborg)", "*File*", "a("));
+ // a wildcard with regular expression characters keeps its wildcard
match too, unless it ends with .*
+
assertEquals("\\Qmy.app\\E.*|(?:my.app*)|\\QBeer(X)\\E.*|(?:Beer(X)*)|(?:kafka.*)|\\Q{{keep}}\\E",
+ PatternHelper.combinePatterns("my.app*", "Beer(X)*",
"kafka.*", "{{keep}}"));
+ }
+
+ @Test
+ void testCombinePatternsMatchesAsAnyOfThePatterns() {
+ String[] patterns = {
+ "header1", "Camel*", "Beer(Heineken|Tuborg)", ".*Id",
"my.app*", "Beer(X)*", "kafka.*", "*File*", "a(",
+ "x-y", "*" };
+ String[] names = {
+ "header1", "HEADER1", "header2", "Camel", "Came",
"CamelFileName", "camelfoo", "BeerHeineken",
+ "beertuborg", "BeerCarlsberg", "breadcrumbId", "my.app",
"my.app.id", "MY.APP.ID", "myXapp", "my.ap",
+ "Beer(X)foo", "BeerX", "BeerXX", "kafka.TOPIC", "kafkaTopic",
"*FileName", "FileName", "a(", "A(", "a",
+ "x-y", "xy" };
+ for (int i = 0; i < patterns.length; i++) {
+ for (int j = i + 1; j <= patterns.length; j++) {
+ String[] some = Arrays.copyOfRange(patterns, i, j);
+ String combined = PatternHelper.combinePatterns(some);
+ for (String name : names) {
+ assertEquals(PatternHelper.matchPatterns(name, some),
PatternHelper.matchPattern(name, combined),
+ () -> "name=" + name + " patterns=" +
Arrays.toString(some) + " combined=" + combined);
+ }
+ }
+ }
+ }
+
// the documented match rules: exact, match all, wildcard and last the
regular expression for every other name
private static boolean alwaysTryingTheRegex(String name, String pattern) {
if (name.equalsIgnoreCase(pattern) || "*".equals(pattern)) {
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/org/apache/camel/dsl/jbang/core/commands/ai/eip-samples.json
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/org/apache/camel/dsl/jbang/core/commands/ai/eip-samples.json
index 38cead2caf95..64632f5194c2 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/org/apache/camel/dsl/jbang/core/commands/ai/eip-samples.json
+++
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/org/apache/camel/dsl/jbang/core/commands/ai/eip-samples.json
@@ -963,6 +963,10 @@
{
"source": "removeHeaders-eip.adoc",
"yaml": "- route:\n from:\n uri: seda:b\n steps:\n -
removeHeaders: \"Camel*\"\n - to:\n uri: mock:result\n"
+ },
+ {
+ "source": "removeHeaders-eip.adoc",
+ "yaml": "- route:\n from:\n uri: seda:b\n steps:\n -
removeHeaders:\n pattern: \"*\"\n excludePattern:
\"header1|header3|Camel.*\"\n - to:\n uri: mock:result\n"
}
],
"removeProperties": [
@@ -973,6 +977,10 @@
{
"source": "removeProperties-eip.adoc",
"yaml": "- route:\n from:\n uri: seda:b\n steps:\n -
removeProperties:\n pattern: \"Foo*\"\n - to:\n
uri: mock:result\n"
+ },
+ {
+ "source": "removeProperties-eip.adoc",
+ "yaml": "- route:\n from:\n uri: seda:b\n steps:\n -
removeProperties:\n pattern: \"Foo*\"\n excludePattern:
\"FooKeep|FooToo\"\n - to:\n uri: mock:result\n"
}
],
"removeProperty": [
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index bed0d9dc63f0..31b2b43aa5c9 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -13820,7 +13820,7 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
properties = {
@YamlProperty(name = "description", type = "string",
description = "The description for this node", displayName = "Description"),
@YamlProperty(name = "disabled", type = "boolean",
defaultValue = "false", description = "Whether to disable this EIP from the
route during build time. Once an EIP has been disabled then it cannot be
enabled later at runtime.", displayName = "Disabled"),
- @YamlProperty(name = "excludePattern", type = "string",
description = "Name or pattern of headers to not remove. You can use comma to
separate multiple patterns.", displayName = "Exclude Pattern"),
+ @YamlProperty(name = "excludePattern", type = "string",
description = "Name or pattern of headers to not remove. The pattern supports
exact match, wildcard (pattern ends with *), and regular expression (all
case-insensitive). To keep several headers, use a regular expression such as
header1|header3.", displayName = "Exclude Pattern"),
@YamlProperty(name = "id", type = "string", description =
"The id of this node", displayName = "Id"),
@YamlProperty(name = "note", type = "string", description
= "The note for this node", displayName = "Note"),
@YamlProperty(name = "pattern", type = "string", required
= true, description = "Name or pattern of headers to remove. The pattern
supports exact match, wildcard (pattern ends with *), and regular expression
(all case-insensitive).", displayName = "Pattern")
@@ -13895,7 +13895,7 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
properties = {
@YamlProperty(name = "description", type = "string",
description = "The description for this node", displayName = "Description"),
@YamlProperty(name = "disabled", type = "boolean",
defaultValue = "false", description = "Whether to disable this EIP from the
route during build time. Once an EIP has been disabled then it cannot be
enabled later at runtime.", displayName = "Disabled"),
- @YamlProperty(name = "excludePattern", type = "string",
description = "Name or pattern of properties to not remove. You can use comma
to separate multiple patterns.", displayName = "Exclude Pattern"),
+ @YamlProperty(name = "excludePattern", type = "string",
description = "Name or pattern of properties to not remove. Supports exact
match, wildcard (ending with *), and regular expression (all case-insensitive).
To keep several properties, use a regular expression such as prop1|prop3.",
displayName = "Exclude Pattern"),
@YamlProperty(name = "id", type = "string", description =
"The id of this node", displayName = "Id"),
@YamlProperty(name = "note", type = "string", description
= "The note for this node", displayName = "Note"),
@YamlProperty(name = "pattern", type = "string", required
= true, description = "Name or pattern of properties to remove. Supports exact
match, wildcard (ending with *), and regular expression (all
case-insensitive).", displayName = "Pattern")
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
index d7cac5aed455..d4552e567ac1 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
@@ -3485,7 +3485,7 @@
"excludePattern" : {
"type" : "string",
"title" : "Exclude Pattern",
- "description" : "Name or pattern of headers to not remove. You can
use comma to separate multiple patterns."
+ "description" : "Name or pattern of headers to not remove. The
pattern supports exact match, wildcard (pattern ends with *), and regular
expression (all case-insensitive). To keep several headers, use a regular
expression such as header1|header3."
},
"id" : {
"type" : "string",
@@ -3525,7 +3525,7 @@
"excludePattern" : {
"type" : "string",
"title" : "Exclude Pattern",
- "description" : "Name or pattern of properties to not remove. You
can use comma to separate multiple patterns."
+ "description" : "Name or pattern of properties to not remove.
Supports exact match, wildcard (ending with *), and regular expression (all
case-insensitive). To keep several properties, use a regular expression such as
prop1|prop3."
},
"id" : {
"type" : "string",
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
index 79029270856b..058d06ae0284 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
@@ -5991,7 +5991,7 @@
}, {
"name" : "excludePattern",
"type" : "string",
- "description" : "Name or pattern of headers to not remove. You can use
comma to separate multiple patterns.",
+ "description" : "Name or pattern of headers to not remove. The pattern
supports exact match, wildcard (pattern ends with *), and regular expression
(all case-insensitive). To keep several headers, use a regular expression such
as header1|header3.",
"title" : "Exclude Pattern",
"displayName" : "Exclude Pattern",
"kind" : "attribute",
@@ -6057,7 +6057,7 @@
}, {
"name" : "excludePattern",
"type" : "string",
- "description" : "Name or pattern of properties to not remove. You can
use comma to separate multiple patterns.",
+ "description" : "Name or pattern of properties to not remove. Supports
exact match, wildcard (ending with *), and regular expression (all
case-insensitive). To keep several properties, use a regular expression such as
prop1|prop3.",
"title" : "Exclude Pattern",
"displayName" : "Exclude Pattern",
"kind" : "attribute",
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 255421f9d128..2fd6ae5d748c 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -4631,7 +4631,7 @@
"excludePattern" : {
"type" : "string",
"title" : "Exclude Pattern",
- "description" : "Name or pattern of headers to not remove. You
can use comma to separate multiple patterns."
+ "description" : "Name or pattern of headers to not remove. The
pattern supports exact match, wildcard (pattern ends with *), and regular
expression (all case-insensitive). To keep several headers, use a regular
expression such as header1|header3."
},
"id" : {
"type" : "string",
@@ -4675,7 +4675,7 @@
"excludePattern" : {
"type" : "string",
"title" : "Exclude Pattern",
- "description" : "Name or pattern of properties to not remove.
You can use comma to separate multiple patterns."
+ "description" : "Name or pattern of properties to not remove.
Supports exact match, wildcard (ending with *), and regular expression (all
case-insensitive). To keep several properties, use a regular expression such as
prop1|prop3."
},
"id" : {
"type" : "string",