You just need to add the annotation
@ProduceMime({"application/xml", "application/json"})
to your service methods. You can add
@ConsumeMime({"application/xml", "application/json"})
to allow the to receive input in both formats as well. I am assuming that
you are using the JAXRS front-end. You'll also need to add Jettison
(org.codehaus.jettison) as a dependency.
Cheers,
Britt Crawford
arimus wrote:
>
> Is there a way to use the same service class and methods to generate
> both XML and JSON output depending on say the client "Accept" format?
> Or if not possible, what about mapping the same service methods to
> different URLs with different output types.
>
> Cheers,
> David
>
>
>
--
View this message in context:
http://www.nabble.com/CXF-REST---output-in-both-XML---JSON-tp18124045p18163838.html
Sent from the cxf-user mailing list archive at Nabble.com.