camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralf Steppacher <ralf.steppac...@derivativepartners.com>
Subject RESTful route with Apache CXF
Date Fri, 07 Sep 2012 14:35:39 GMT
Hello all,

a quick question about using RESTful endpoints:
Given the route and resource definition below, I end up with the JSON
representation of the PriceRequestMessage in the exchange body, not the
Java object of type PriceRequestMessage. Is there a way to keep the
object as it was created by the nameValueProvider and passed into
getIndicativePrice(PRM prm) in the exchange body and only marshal the
object to the format requested by the client at the very end of the
route?

@POST
@Path("/price")
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
public PriceRequestMessage getIndicativePrice(PriceRequestMessage prm) {
  return prm;
}

<camel:route id="rest.route.request.price">
  <camel:from ref="jettyEndpoint" />
  <camel:to
uri="cxfbean:pricingResource?providers=#jsonJacksonProvider,#nameValueProvider" />
  <camel:enrich ref="mq.queue.pricerequest" />
</camel:route>


Thanks!
Ralf

Mime
View raw message