Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8355CDEED for ; Wed, 19 Sep 2012 13:50:38 +0000 (UTC) Received: (qmail 61413 invoked by uid 500); 19 Sep 2012 13:50:38 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 61373 invoked by uid 500); 19 Sep 2012 13:50:38 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 61364 invoked by uid 99); 19 Sep 2012 13:50:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2012 13:50:38 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2012 13:50:32 +0000 Received: by lbbgm13 with SMTP id gm13so1146884lbb.32 for ; Wed, 19 Sep 2012 06:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=GqhOAllioLiQQJ9oi3DMuADTVmv0b2D349kHQt7vMXM=; b=mwpJi4Jbh3xWr/MHx4ZCw16fjlmlWL6VaaeUnIogbxfK/TpqElLsqfGIwQRegCPJCO I+HyWtHMTXiYezhJWdAjCPHbhsoHZp8tzF19HpVXBGx6BbBNL8A+q9UUYbnfzwS7QWuV zRDvcHzUxwxx12syx8I5okLMv2w0zhXthel9p6JV2Yv7De4xdyA0qbIwgjvBXHzY9vRg s9GsccglOPQOwfO6B4PqN5STvw6P4gH5mvoINoH1ZkHG88kYGeOgXFfamzaQJiTwdHFu iwk2CAutRjXUIRSGXbRjM3dDM4e4ICxL1tPC2DP0iqAfVYWjfN6gPApbEYeKKzyIL3if NnTQ== Received: by 10.152.103.146 with SMTP id fw18mr2752616lab.30.1348062611830; Wed, 19 Sep 2012 06:50:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.7.230 with HTTP; Wed, 19 Sep 2012 06:49:51 -0700 (PDT) In-Reply-To: <1348061404488-5719590.post@n5.nabble.com> References: <1347919929535-5719498.post@n5.nabble.com> <1347992533515-5719540.post@n5.nabble.com> <1348061404488-5719590.post@n5.nabble.com> From: Claus Ibsen Date: Wed, 19 Sep 2012 15:49:51 +0200 Message-ID: Subject: Re: String replacement via Spring To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 The replace method on java.lang.String accepts only char as parameters, and not another string. Hence why it wont work. eg "foo" is not a char. On Wed, Sep 19, 2012 at 3:30 PM, gramanero wrote: > Hi Henryk, > > I apologize for not providing more information. I guess I thought there was > enough context within the thread that one could understand what I was > referring to. Sounds like that was not the case. > > The two attempts I made using Spring are as follows: > > What Claus suggested: > > ${body.replaceAll("foo", "bar")} > > > Same thing as what Claus suggested with the exception of using .replace > instead of .replaceAll. > > ${body.replace("foo", "bar")} > > > The replacement strings that I am using in the example above are not really > what I want in the end, but I wanted to just get anything working at this > point. The point of my last response is that neither solution appears to be > behaving as I would expect, but again I am wondering if this just isn't > something that the Simple language can handle. I would like to know if the > errors I posted earlier are expected or if there is some other underlying > problem with the Simple language parser. > > The real transform that I am trying to get to is something like this: > > ${body.replace("\\", "\\\\")} > > > I just need to replace all single backslashes in a windows-based fully > qualified file path with double backslashes such that I can send the JSON > packet to a restful service. Right now, the request is failing to send to > the .NET restful service due to the backslashes in the file path. If I > manually change the single backslashes to double backslashes, the JSON > packet is accepted and processed by the restful service. I also thought > about using headers to send the information, but this doesn't seem like a > "restful"way of doing things. > > Another approach would be to URL encode the file path, but I can't seem to > find a way to do that in Spring either. I am very new to Camel, so I am just > hoping that I am missing something simple. > > Thank you for the response and sorry for not being clear enough in my > previous post. > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/String-replacement-via-Spring-tp5719498p5719590.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen