Java API for RESTful Web Services
|Developer(s)||Oracle Corporation (initial code from Sun Microsystems)|
2.1.6 / September 10, 2019
|Platform||Java Virtual Machine|
|License||CDDL v1.1 and GPL v2|
Jakarta RESTful Web Services, (JAX-RS) is a Java programming language API spec that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints.
From version 1.1 on, JAX-RS is an official part of Java EE 6. A notable feature of being an official part of Java EE is that no configuration is necessary to start using JAX-RS. For non-Java EE 6 environments a small entry in the web.xml deployment descriptor is required. The project was previously named "Java API for RESTful Web Services", and was renamed and moved to the Eclipse Foundation, under the Jakarta EE banner, in April 2019.
@Pathspecifies the relative path for a resource class or method.
@HEADspecify the HTTP request type of a resource.
@Producesspecifies the response Internet media types (used for content negotiation).
@Consumesspecifies the accepted request Internet media types.
In addition, it provides further annotations to method parameters to pull information out of the request. All the
@*Param annotations take a key of some form which is used to look up the value required.
@PathParambinds the method parameter to a path segment.
@QueryParambinds the method parameter to the value of an HTTP query parameter.
@MatrixParambinds the method parameter to the value of an HTTP matrix parameter.
@HeaderParambinds the method parameter to an HTTP header value.
@CookieParambinds the method parameter to a cookie value.
@FormParambinds the method parameter to a form value.
@DefaultValuespecifies a default value for the above bindings when the key is not found.
@Contextreturns the entire context of the object (for example
@Context HttpServletRequest request).
In January 2011 the JCP formed the JSR 339 expert group to work on JAX-RS 2.0. The main targets are (among others) a common client API and support for Hypermedia following the HATEOAS-principle of REST. In May 2013, it reached the Final Release stage.
Implementations of JAX-RS include:
- Apache CXF, an open source Web service framework
- Jersey, the reference implementation from Sun (now Oracle)
- RESTeasy, JBoss's implementation
- WebSphere Application Server from IBM:
- Version 7.0: via the "Feature Pack for Communications Enabled Applications"
- Version 8.0 onwards: natively
- WebLogic Application Server from Oracle, see notes
- Apache Tuscany (http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html), discontinued
- Cuubez framework (https://web.archive.org/web/20190707005602/http://cuubez.com/)
- Everrest, Codenvy's Implementation
- Jello-Framework, Java Application Framework optimized for Google App Engine, including a powerful RESTful engine and comprehensive Data Authorization model.
- Hadley, p. 1.
- "JSR 339: JAX-RS 2.0: The Java API for RESTful Web Services". Java Community Process.
- "JSR 370: Java API for RESTful Web Services (JAX-RS 2.1) Specification". Java Community Process.
- "JSR 367: Java API for JSON Binding (JSON-B)". Java Community Process.
- Little, Mark (October 1, 2008). "A Comparison of JAX-RS Implementations".