Hi all, 

I am trying to send to the caller (HTTP request) an http response with a
fixed message in the body (and an error status code, of course) 

My route is : 

<from uri="servlet:///XXX?matchOnUriPrefix=true" />
<inOnly uri="activemq:queue:YYYY" />
... 

In case of exception (ActiveMq not connected for example), I received an
response with an error status code but with the stacktrace in the body. I
would like to replace this body with a fixed message, like "error occured". 

I have tried with OnException and doesn't work at all ... 

I have tried with doTry doCatch, and the result is different (not really
better): Now, if handled, I receive an 200 status response with no Body. If
not handled, no change ... 

My code 

<camel:doCatch>
                <exception>java.lang.Exception</exception>
                <camel:handled>
                        <camel:constant>true</camel:constant>
                </camel:handled>
                        <camel:transform>
                                <camel:constant>TESTTTTTT</camel:constant>
                        </camel:transform>
                        <camel:log
message="AAAAAAAAAAAAAAAAAAAAAAAAAA"></camel:log>
</camel:doCatch>

I have tried some different case : with setBody, with setFaultBody, ... and
i have never successed to display a custom message in the http  response 

Anyone can help me please ? 

Thank you 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-Handling-and-HTTP-response-tp5728599.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to