@GET @Path("/ids/{printerid}")
@Produces({"application/json", "application/xml"})
public Printer getPrinter(@PathParam("printerid") String printerId) { ... }
getPrinter
HTTP method GET
/ids/{printerid}
Produces
json
xml
Object
URI
xml/json
xml/json
This is the whole idea of Jersy layer / spring controller, they encapsulate it and convert the class to JSON. You can have the same result with Gson
Gson gson = new Gson();
String json = gson.toJson(printerObject);
System.out.println(json);
Not sure if Jersy is using Gson, but the logic will be probably the same