Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

@produce annotation  RSS feed

 
vijay jacob
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What exactly @produce does . does it converts the java object to JSON response .If we configure @produce mediaType--> JSON
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jacob,

When constructing the response body Jersey internally tries to find a MessageBodyWriter that can turn Item objects into xml/json. Usually the programmer supplies these 'mapper' classes, but for XML and JSON Jersey has built in MessageBodyReaders already for convenience.

That is why it appears as if there was going on some magic.

Thanks,
Kesava.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!