Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 18114 invoked from network); 1 Jan 2011 21:42:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jan 2011 21:42:09 -0000 Received: (qmail 42400 invoked by uid 500); 1 Jan 2011 21:42:09 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 42374 invoked by uid 500); 1 Jan 2011 21:42:09 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 42366 invoked by uid 500); 1 Jan 2011 21:42:09 -0000 Delivered-To: apmail-activemq-camel-dev@activemq.apache.org Received: (qmail 42363 invoked by uid 99); 1 Jan 2011 21:42:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Jan 2011 21:42:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Jan 2011 21:42:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p01LfjT6006391 for ; Sat, 1 Jan 2011 21:41:45 GMT Message-ID: <5781917.93781293918105792.JavaMail.jira@thor> Date: Sat, 1 Jan 2011 16:41:45 -0500 (EST) From: "Richard Kettelerij (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Issue Comment Edited: (CAMEL-3429) Extend DSL with more header filtering constructs In-Reply-To: <26839216.126071292371569509.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAMEL-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976450#action_12976450 ] Richard Kettelerij edited comment on CAMEL-3429 at 1/1/11 4:41 PM: ------------------------------------------------------------------- @Claus, see refined patch. This patch add a new {{removeHeaders(pattern, exceptionPatterns)}} method as discussed. So it's just one new method now instead of three in my original patch. I did make the {{exceptionPatterns}} a vararg though. Not for the purpose of making it optional (which is somewhat a trick indeed) but simply because there are cases that require multiple header names to be preserved (and you want a convenient way to do this). So now you can write: {code} from(...).removeHeaders("*", "http*").to(...) {code} as well as: {code} from(...).removeHeaders("*", "fish", "chips", "cheese").to(...) {code} I've also updated the JAXB model for the Spring DSL. was (Author: rkettelerij): @Claus, see refined patch. This patch add a new {{removeHeaders(pattern, exceptionPatterns)}} method as discussed. So it's just one new method now instead of three in my original patch. I did make the {{exceptionPatterns}} a vararg however. Not for the purpose of making it optional (which is somewhat a trick indeed) but simply because there are cases that require multiple header names to be preserved (and you want a convenient way to do this). So now you can write: {code} from(...).removeHeaders("*", "http*").to(...) {code} as well as: {code} from(...).removeHeaders("*", "fish", "chips", "cheese").to(...) {code} I've also updated the JAXB model for the Spring DSL. > Extend DSL with more header filtering constructs > ------------------------------------------------ > > Key: CAMEL-3429 > URL: https://issues.apache.org/jira/browse/CAMEL-3429 > Project: Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.5.0 > Reporter: Richard Kettelerij > Fix For: 2.6.0 > > Attachments: remove-headers-camel-core-v2.patch, 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.