You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2015/09/03 19:02:17 UTC

Rest DSL: multiple produces values

Hi

Is it possible to have a single REST DSL route producing multiple 
formats, example, either JSON or XML ?
I thought it was possible but not sure now.
Suppose I have a client with

Accept: application/json, application/xml
(with .q factor if needed)

and I thought if I have .produces(application/json, application/xml) in 
RESTDSL then it will work. But API only allows to set a single binding 
mode for a given route, ex either XML or JSON. I can see I can bypass it 
for CXF by not setting a binding mode at all and simply expecting users 
to rely on JAX-RS providers. But, Claus, perhaps you might want to 
review it and consider adding multiple binding modes - sorry if it is 
actually possible, do not see for now.

The other concern I have now is the selection criteria between multiple 
matching routes, example, /a/{b}/c and /a/{b}/{c}, both matching GET 
/a/b/c. Possibly not an issue for trivial APIs but otherwise there has 
to be a selection criteria in place. Perhaps REST DSL consumers may 
optionally advise via some future API improvements which route has to be 
chosen when multiple candidates are available ?

Thanks, Sergey