November 2017
Intermediate to advanced
420 pages
10h 29m
English
JAX-RS uses javax.ws.rs.ext.MessageBodyReader for mapping the HTTP request entity body to an appropriate Java type. On the other hand, javax.ws.rs.ext.MessageBodyWriter is used for mapping the Java type returned by a resource class method to the appropriate HTTP response entity body representation, such as JSON, XML, and text. The MessageBodyReader and MessageBodyWriter implementations will raise javax.ws.rs.WebApplicationException if they do not know how to convert the input data.
JAX-RS offers the default content handlers (entity providers) for all common data types. Here is a list of the Java types supported by JAX-RS by default: