Hello
thanks whoever reads this post.
I understodd from the JEE 7 tutorial that whenever you use JAXB classes as
parameters or return types
you can also use the them for generating/reading JSON.
It's enough to add "application/json" :
@Produces({"application/xml","application/json"}) or
@Consumes({"application/xml","application/json"})
But i tried this in CXF JAX-RS and it didn't work without adding the Jackson
JSON provider.
I cite the tutorial:
The JEE tutorial says in chapter 31.7.3
"
JAX-RS can automatically read and write XML using JAXB, but it can also work
with
JSON data
.....
You can add the format application/json or MediaType.APPLICATION_JSON to the
@Produces annotation in resource methods to produce responses with JSON
data:
@GET
@Path("/get")
@Produces({"application/xml","application/json"})
public Product getProduct() { ... }
In this example, the default response is XML, but the response is a JSON
object if the
client makes a GET request that includes this header:
Accept: application/json
"
Thanks.
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html