camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sogabe <sogabe.se...@nttcom.co.jp>
Subject camel-rest component not compatible with REST-DSL
Date Tue, 02 Feb 2016 06:47:56 GMT
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.

Mime
View raw message