> -----Original Message-----
> From: cgswtsu78 [mailto:[email protected]]
> Sent: Tuesday, December 01, 2009 2:44 PM
> To: [email protected]
> Subject: How to use CXF and JSON
>
>
> Hello,
>
> I'm very new to building RESTful webservices using apache cxf and I
> currently have a small sample that returns a javax.ws.rs.core.Response
> in
> xml format using the @ProduceMime("application/xml"). My question is
> how do
> I return a javax.ws.rs.core.Response in JSON format? I've tried using
> @ProduceMime("text/json"), @ProduceMime("application/json"). I'm
using
> JAXB
> to convert the object to xml and then rebuilding the response, but I'm
> not
> sure how to rebuild the response when I return json. Is this possible
> with
> CXF?
The "old" "@ProduceMime" annotation has been replaced with "@Produces".
The following will make a method produce either XML or JSON, depending
on the Accept header value:
@Produces({"application/xml", "application/json"})