camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Kettelerij (JIRA)" <>
Subject [jira] Commented: (CAMEL-3429) Extend DSL with more header filtering constructs
Date Wed, 15 Dec 2010 21:18:00 GMT


Richard Kettelerij commented on CAMEL-3429:

@Claus, thanks for the tip on using a regex. I do however think it's rather cumbersome to
write a negative regex in case you only want to preserve a couple of headers and remove all
others. Passing header names as a vararg is a lot more convenient :). The argument for extra
removeHeader() methods lies really in the above mentioned (and often required) defensive approach
with respect to header propagation.

I see the point. If it's about the number of methods a solution could be to create more groups
of similar methods. So instead of:


You write:


In the above case it's ok to add a few extra removeHeader() methods because only header related
methods are shown when using code completion. This breaks off course backwards compatibility
so I agree it should only be done in 3.0.

> Extend DSL with more header filtering constructs
> ------------------------------------------------
>                 Key: CAMEL-3429
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Richard Kettelerij
>             Fix For: Future
>         Attachments: remove-headers-camel-core.patch
> Currently the DSL offers the following methods:
> - {{removeHeader(name)}} which removes a single header
> - {{removeHeaders(pattern)}} remove one or more headers based on a pattern (since 2.3)
> The attached patch extends the DSL with the following methods:
> - {{removeHeaders(name...)}} removes the headers in the given a vararg parameter. 
> - {{removeHeadersExcept(pattern)}} removes all headers except for the ones matching the
given pattern (opposite of {{removeHeaders(pattern)}})
> - {{removeHeadersExcept(name...)}} removes all headers except for the ones in the given
vararg parameter (opposite of {{removeHeaders(name)}})
> The rationale for the removeHeadersExcept() method is that in many cases you want to
take a _defensive_ approach with regard to header propagation.
> Sometimes you may want to remove _every_ header on the current message, in that case
just call removeHeadersExcept() with no arguments.
> In other cases you want to propagate only the "id" header received through the servlet/jetty
component (as a query parameter). In that case call
> removeHeadersExcept("id") to preserve the "id" header, while preventing other query parameters
(and standard HTTP headers) to flow down your route.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message