File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Confusion about JAX-RS annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Confusion about JAX-RS annotations" Watch "Confusion about JAX-RS annotations" New topic

Confusion about JAX-RS annotations

Christian Nicoll
Ranch Hand

Joined: Mar 09, 2008
Posts: 106
Hello Ranchers,
I'm making my first steps with REST and for that i'm using the Jersey implementation. I found two different tutorials:

In the first one I found annotations like @Path, @Get, @Post, @Consumes, and @Produces. All of them are describend in the 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,

My SCBCD-Notes - My Hello World Webservice
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
First of all, the universal truth about JAX-RS (JSR-311) can be found in the specification document available here:
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

Joined: Mar 09, 2008
Posts: 106
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.
I agree. Here's the link:
subject: Confusion about JAX-RS annotations
It's not a secret anymore!