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

Reply via email to