0

Is there any scenario or side-effect when we want to write write @javax.ws.rs.GET and @javax.ws.rs.Consumes at the same time on the same method?

Documentation for javax.ws.rsConsumes says "A container is responsible for ensuring that the method invoked is capable of consuming the media type of the HTTP request entity body" and GET does not have body, but using both annotations is allowed (i.e. no exception or any warning).

1 Answers1

0

Oracle Doc's says

The @Consumes annotation is used to specify the MIME media types of representations a resource can consume that were sent by the client.

Link to Documentation: click!

I don't think that there is gonna be a side effect. Here's an example from the documentation:

@POST
@Consumes("text/plain")
public void postClichedMessage(String message) {
    // Store the message
}
Quan VO
  • 1,070
  • 9
  • 17