JAX-RS REST @Consumes Example

Previously we have learnt about how to produce different types of responses using @Produces annotation, In this article we will learn how to consume different types of request from the user using @Consumes annotation.

@Consumes annotation is used to specify the MIME media types that a resource can consume. @Consumes can be applied at both class level and method level, If applied on class level all the methods can produce the specified MIME types by default. If it is applied at the method level, it overrides any @Consumes annotations applied at the class level.
[Read more…]