Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Confusion about JAX-RS annotations

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,
I'm making my first steps with REST and for that i'm using the Jersey implementation. I found two different tutorials:
http://www.suryasuravarapu.com/2009/03/rest-crud-with-jax-rs-jersey.html
http://developers.sun.com/docs/web/swdp/r2/tutorial/doc/p34.html

In the first one I found annotations like @Path, @Get, @Post, @Consumes, and @Produces. All of them are describend in the javax.ws.rs package. On the second link I found similar - but different - annotations like @UriTemplate, @HttpMethod, @ConsumeMime and @ProduceMime.

Can anyone explain me why we've those similar annotations and which one I should use?

Best regards,
Christian
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
First of all, the universal truth about JAX-RS (JSR-311) can be found in the specification document available here:
http://jcp.org/en/jsr/detail?id=311
Second, regarding the annotations:
It seems like some of the annotations you mention are obsolete - perhaps their names have been changed.
The ones not in the specification are: @UriTemplate, @ConsumeMime and @ProduceMime.

The JAX-RS 1.1 specification contains an excellent summary of JAX-RS annotations in appendix A.
Best wishes!
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ivan,
it is always a pleasure when I answer (one of mine) questions. Thank's for the nice hint with the appendix A, that was the paper what I was looking for.
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic