I'm trying to get my head around some concepts in Java:
Am I completely off or onto someting?
JAX-RS is an specification (just a definition) and Jersey is a JAX-RS implementation. Jersey framework is more than the JAX-RS Reference Implementation. Jersey provides its own API that extend the JAX-RS toolkit with additional features and utilities to further simplify RESTful service and client development.
JAX-RS is a JAVA based programming language API and specification to provide support for created RESTful Web Services. Its 2.0 version was released on the 24th May 2013. JAX-RS uses annotations available from Java SE 5 to simplify the development of JAVA based web services creation and deployment.
Actually,JAX-WS represents both RESTful and SOAP based web services. One way to think about it is that JAX-RS specializes in RESTful, while JAX-WS allows you more flexibility to choose between either, while at the same time being (in some cases) more complicated to configure.
JAX-RS is a standard defined in Java Specification Request 311 (JSR-311) and Jersey / RESTEasy are implementations of it.
Yes, this isn't anything new. Think about JDBC, java provides the
interfaces (Connection
, Statement
, ResultSet
etc) but it is up
to database vendors to provide implementations.
If you're using a JSR-311 implementation like Jersey or Apache CXF
then you'll annotate your classes with the javax.ws.rs
annotations, such as @Path
, @GET
, @Produces
etc. This is why you need to explicitly have JSR-311 as a maven dependency.
Yes, usually. Have a look at the JSR list on wiki.
You need both the JSR and the implementation. The annotations are in the JSR, the implementation provides supporting classes, such as com.sun.jersey.spi.container.servlet.ServletContainer
.
No, it is necessary to have both as dependencies (see point 4); you won't get classpath conflicts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With