Prasad Weera
Prasad Weera

Reputation: 1299

Using javax.ws.rs jar instead of Jersey or Apache CXF

In java Rest implementation, do we have to use Jersey or Apache CXF or any other implementation ? I mean in dependency wise , I've only used javax.ws.rs and it works fine.

Upvotes: 2

Views: 2481

Answers (2)

Martin Matula
Martin Matula

Reputation: 7989

Prasad, the javax.ws.rs includes just API. It won't work on it's own - you need some implementation behind it. If you are saying it is working for you currently, it is probably because you are deploying it to some server that already has an implementation of that API built in (such as GlassFish, WebLogic or any other JavaEE 6 compliant server - since JAX-RS is part of EE6, all EE6 compliant app. servers would have some implementation of that API - GF and WLS use Jersey, JBoss uses RESTEasy, some other servers may use something else).

Upvotes: 2

yves amsellem
yves amsellem

Reputation: 7244

Jersey is the open source JAX-RS (JSR 311) Reference Implementation for building RESTful Web services.

I've used Jersey a lot, and, expected in rare configuration cases, you won't notice it — just use JAX-RS. Apache CXF was builded for SOAP and adapted to ReST, it's far more complicated than Jersey, IMO.

The Jersey Maven dependencies are the following:

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.14</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-servlet</artifactId>
    <version>1.14</version>
</dependency>

Upvotes: 2

Related Questions