Currently my rest resources look like this:
@GET
@Override
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<Customer> findAll() {
return super.findAll();
}
From the looks of it, I feel like
curl -v -H "Accept:application/json" -H "Accept-encoding:gzip" http://localhost:8080/mavenproject1/webresources/com.mycom.mavenproject1.customer
should get me a response in JSON but, I get an error instead. How can I force a JSON response with JAX-RS?
I was working on this project using Netbeans to auto-generate the code. First, it created entity classes from a database, then rest classes to access the entity classes, and finally it auto-generated a rest client using Knockout.js.
However, Netbeans did not add org.json, com.sun.jersey, and com.sun.jersey to the pom.xml file. I added the above dependencies and now, I can get json responses as expected.