November 2017
Intermediate to advanced
420 pages
10h 29m
English
The @javax.ws.rs.Produces annotation is used for defining the internet media type(s) that a REST resource class method can return to the client. You can define this either at the class level (which will get defaulted for all methods) or at the method level. The method-level annotations override the class-level annotations. The possible internet media types that a REST API can produce are as follows:
The following example uses the @Produces annotation at the class level in order to set the default response media type as JSON for all the resource methods in this class. At runtime, ...