简体   繁体   中英

Is Jersey just a framework for developing RESTful web services in Java?

The way I understand it is Java EE 6 includes the classes for java.ws.rs (JAX-RS) which are defined in the JSR 311 spec document. But I don't know why you would use Jersey or Apache CXF if the base classes are already built into Java EE 6. Can you not create a RESTful web service with those classes alone? Are Jersey, Apache CXF, etc just frameworks to make development of REST-based web services easier?

why you would use Jersey or Apache CXF if the base classes are already built into Java EE 6. Can you not create a RESTful web service with those classes alone?

Java EE only defines standards, those classes are the standard API, but there is no implementation behind them. Jersey and CXF are competing implementations of the standard.

However, if you have a server that claims to support Java EE 6, it will have to contain an implementation for every API that's in the standard. For example, Glassfish includes Jersey, so you don't have to add it explicitly.

JAX-RS is just a specification. In order to use JAX-RS, you need an implementation of the spec.

Jersey is a JAX-RS implementation. Specifically, it is the reference implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM