I'm using blueprint, but yes, it does not work.

    <cml:setBody>
        <cml:simple>{ "exception": "${exception.message}" }</cml:simple>
    </cml:setBody>

Produces response content of:
    "{ \"error\": \"${exception.message}\" }"

Instead of:
    { "error": "${exception.message}" }


I'm using the servlet/rest config, ie:
    <camelContext>
        <restConfiguration component="servlet" bindingMode="json"/>
        <rest consumes="application/json" produces="application/json">
            <post>
                <route>
                    < !-- lots of magic -->
                    <onException>
                        <exception>net.me.MyException</exception>
                        <handled><constant>true</constant></handled>
                        < !-- more magic -->
                        <setBody>
                            <simple>{ "error": "${exception.message}"
}</simple>
                        </setBody>
                    </onException>
                </route>
            </post>
        </rest>
    </camelContext>

(Sorry. I should have included this snippet in the first email)

Cheers,
Gary




--
View this message in context: 
http://camel.465427.n5.nabble.com/Setting-rest-response-json-directly-tp5758518p5758563.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to