Hi

Charles you know better!

The Spring DSL is 1:1 to the Java DSL.

So just use
<setHeader>

  <camelContext xmlns="http://camel.apache.org/schema/spring";>
    <route>
      <from uri="seda:a"/>
      <setHeader headerName="oldBodyValue">
        <simple>body</simple>
      </setHeader>
      <to uri="mock:b"/>
    </route>
  </camelContext>


And check the unit test source code in camel-spring if you are in a
bit of doubt and want to look for an example.

And check the Spring XSD
http://camel.apache.org/schema/spring/


On Tue, Dec 7, 2010 at 11:28 AM, Charles Moulliard <cmoulli...@gmail.com> wrote:
> Hi,
>
> I try to convert the following syntax in Spring DSL but get error and cannot
> find how to add transform.
>
> from("jetty://http://localhost:{{port}}/myserver";)
>    // use onException tocatch  all exceptions andreturn  a custom reply
> message
>    .onException(Exception.class)
>        .handled(true)
>        // create a custom failure response
>        .transform(constant("Dude something went wrong"))
>        // we must remember to set error code 500 as handled(true)
>        // otherwise would let Camel thing its a OK response (200)
>        .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(500))
>    .end()
>    // now just force an exception immediately
>    .throwException(new  IllegalArgumentException("I cannotdo  this"));
>
>
> Here is what I have done :
>
> <from uri="jetty:http://localhost:8080/services"/>
> <onException>
> <exception>java.lang.Exception</exception>
> <redeliveryPolicy maximumRedeliveries="1"/>
> <handled>
> <constant>true</constant>
> </handled>
>               ############ HOW CAN I ADD transform() ###############
> <header name="Exchange.HTTP_RESPONSE_CODE">
> <constant>500</constant>
> </header>
> </onException>
> <bean ref="responseBean"/>
>
> Regards,
>
> Charles
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to