JAX-RS — How to return JSON and HTTP status code together?
问题 I\'m writing a REST web app (NetBeans 6.9, JAX-RS, TopLink Essentials) and trying to return JSON and HTTP status code. I have code ready and working that returns JSON when the HTTP GET method is called from the client. Essentially: @Path(\"get/id\") @GET @Produces(\"application/json\") public M_機械 getMachineToUpdate(@PathParam(\"id\") String id) { // some code to return JSON ... return myJson; } But I also want to return an HTTP status code (500, 200, 204, etc.) along with the JSON data. I