Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is this PUT called in REST webservice  RSS feed

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was going over the example at

http://www.ibm.com/developerworks/web/library/wa-aj-tomcat/

and i was just curious
why the curl command


calls this put method:


and not this

The two methods are same but overloaded how does the compiler know which one to call ??
Why isnt there @Consumes annotation for the second one ?? Is there a default @Consumes annotation


 
Anurag Verma
Ranch Hand
Posts: 170
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is because whenever we hit the server, the underlying framework looks for the best match of the call, which is happening here. You can try hitting the server by changing the application/xml type to text/xml in your curl request & then probably the second method will get called (Not 100% sure as i haven't worked on jersey ever) .
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you saying that if there are no Consume annotations supplied for a method then the default is text ??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!