KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Jersey 1.6 can produce: @Path("/stock") public class StockResource { @GET @Produces(MediaType.APPLICATION_JSON) public List<Stock> get() { Stock stock = new Stock(); stock.setQuantity(3); return Lists.newArrayList(stock); } } But cannot do the same with: @Path("/stock") public class StockResource { @GET @Produces(MediaType.APPLICATION_JSON) public Response get() { Stock stock = new Stock(); stock.setQuantity(3); return Response.ok(Lists.newArrayList(stock)).build(); } } Giving the error: A message body writer for Java class java.util.ArrayList, and Java type class java.util.ArrayList, and MIME media type application/json was not found This prevent the use of HTTP status code and headers.
Tags (comma-separated)
Save Edits
Cancel