You should use the rest-dsl which provides the rest functionality with
{} and get/post and so on.

The rest is not really intended to be used in regular routes, the
rest-dsl is the syntax sugar on top that uses the rest component under
the covers.


On Tue, Feb 2, 2016 at 7:47 AM, sogabe <sogabe.se...@nttcom.co.jp> wrote:
> Hi,
>
> I'm testing camel-rest with the folowing spring xml.
>
>         <restConfiguration component="jetty" scheme="http" host="localhost"
> port="8888" bindingMode="auto" >
>             <dataFormatProperty key="xml.out.mustBeJAXBElement"
> value="false" />
>         </restConfiguration>
>
>         <route>
>             <from uri="rest:get:/book:/{id}/" />    //  <---  (1)
>             <to uri="direct:hello" />
>         </route>
>
>         <route>
>             <from uri="direct:hello" />
>             <process ref="bookProcessor" />
>         </route>
>
> it can't work correctly with Accept header.
>
>   $ curl -H 'Accept:application/json' http://localhost:8888/book/2/
>   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>   <book id="2" title="Apache Camel">
>       <date>2016-02-02T15:12:42.828+09:00</date>
>   </book>
>
> But replace (1) camel-rest  with REST-DSL like this.
>
>        <rest>
>             <get uri="/book/{id}/" >
>                 <to uri="direct:hello" />
>             </get>
>         </rest>
>
> it works correctly.
>
>   $ curl -H 'Accept:application/json' http://localhost:8888/book/2/
>   {"date":1454395087688,"id":"2","title":"Apache Camel"}
>
> Is camel-rest component not compatible with REST-DSL?
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-rest-component-not-compatible-with-REST-DSL-tp5777130.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to