Providers
When you start publishing services, you typically come across scenarios which require some additional layers of processing. You might need some special processing for mapping representations of entities and their Java types. Such cases are handled by supplying an entity provider to the JAXRS runtime. A provider class would implement JAXRS-specific interfaces and additionally use the @Provider
annotation, which is used at runtime for auto-discovery of all providers. Apart from entity providers, there's context providers and exception mapping providers.
Entity providers
Entity providers can be used to do the marshaling and un-marshaling of Java objects to and from another representation. There are two options:
MessageBodyReader
: This class is used to provide a mapping service between an incoming request entity message body to the Java method parameter. Based on the media type used and the Java type of the method parameter, an appropriateMessageBodyReader
provider is chosen at runtime...