@GET @Path("/ids/{printerid}") @Produces({"application/json", "application/xml"}) public Printer getPrinter(@PathParam("printerid") String printerId) { ... } is a piece of a code example found here: https://jersey.java.net/documentation/latest/jaxrs-resources.html#d0e2089
What I understand is:
- the method
getPrinteris called when theHTTP method GETis called on the path/ids/{printerid} - the method
Produceseither ajsonor anxmlresult - the method returns an
Objectof type Printer, identified by the ID provided in theURI
What I don't understand is, how the returned Printer is represented as an xml/json document. We return a Printer in this method, so how do we get an xml/json file from that?