HOME

TheInfoList



OR:

Jakarta RESTful Web Services, (JAX-RS; formerly Java API for RESTful Web Services) is a Jakarta EE API specification that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern. JAX-RS uses
annotation An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
s, 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 Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web se ...
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
deployment descriptor A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine. In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a w ...
is required. There are numerous programming languages, each with its own set of features and benefits. Java is a popular programming language that is used for high-level development.


Specification

JAX-RS provides some annotations to aid in mapping a resource class (a POJO) as a web resource. The annotations use the
Java package A Java package organizes Java classes into namespaces, providing a unique namespace for each type it contains. Classes in the same package can access each other's package-private and protected members. In general, a package can contain the foll ...
jakarta.ws.rs (previously was javax.ws.rs but was renamed on May 19, 2019). They include: *@Path specifies the relative
path A path is a route for physical travel – see Trail. Path or PATH may also refer to: Physical paths of different types * Bicycle path * Bridle path, used by people on horseback * Course (navigation), the intended path of a vehicle * Desire ...
for a resource class or method. *@GET, @PUT, @POST, @DELETE and @HEAD specify the HTTP request type of a resource. *@Produces specifies the response
Internet media type A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication o ...
s (used for
content negotiation Content negotiation refers to mechanisms defined as a part of HTTP that make it possible to serve different versions of a document (or more generally, representations of a resource) at the same URI, so that user agents can specify which version fi ...
). *@Consumes specifies 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. *@PathParam binds the method parameter to a path segment. *@QueryParam binds the method parameter to the value of an HTTP query parameter. *@MatrixParam binds the method parameter to the value of an HTTP matrix parameter. *@HeaderParam binds the method parameter to an HTTP header value. *@CookieParam binds the method parameter to a
cookie A cookie is a baked or cooked snack or dessert that is typically small, flat and sweet. It usually contains flour, sugar, egg, and some type of oil, fat, or butter. It may include other ingredients such as raisins, oats, chocolate chips, ...
value. *@FormParam binds the method parameter to a
form Form is the shape, visual appearance, or configuration of an object. In a wider sense, the form is the way something happens. Form also refers to: * Form (document), a document (printed or electronic) with spaces in which to write or enter dat ...
value. *@DefaultValue specifies a default value for the above bindings when the key is not found. *@Context returns the entire context of the object (for example @Context HttpServletRequest request).


JAX-RS 2.0

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 Hypermedia as the Engine of Application State (HATEOAS) is a constraint of the REST application architecture that distinguishes it from other network application architectures. With HATEOAS, a client interacts with a network application whose ap ...
-principle of
REST Rest or REST may refer to: Relief from activity * Sleep ** Bed rest * Kneeling * Lying (position) * Sitting * Squatting position Structural support * Structural support ** Rest (cue sports) ** Armrest ** Headrest ** Footrest Arts and ente ...
. In May 2013, it reached the Final Release stage. On 2017-08-22 JAX-RS 2.1 specification final release was published. Main new supported features include server-sent events, reactive clients, and JSON-B.


Implementations

Implementations of JAX-RS include: * Apache CXF, an open source Web service framework * Jersey, the
reference implementation In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation ...
from Sun (now
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The wor ...
)
RESTeasy
JBoss WildFly, formerly known as JBoss AS, or simply JBoss, is an application server written by JBoss, now developed by Red Hat. WildFly is written in Java and implements the Java Platform, Enterprise Edition (Java EE) specification. It runs on mu ...
's implementation * Restlet * WebSphere Application Server from IBM: **Version 7.0: via th
"Feature Pack for Communications Enabled Applications"
**Version 8.0 onwards: natively * WebLogic Application Server from
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The wor ...
, se
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. *
Apache TomEE Apache TomEE (pronounced "Tommy") is the Java Enterprise Edition of Apache Tomcat (Tomcat + Jakarta EE = TomEE) that combines several Java enterprise projects including Apache OpenEJB, Apache OpenWebBeans, Apache OpenJPA, Apache MyFaces and others ...
, an addition to
Apache Tomcat Apache Tomcat (called "Tomcat" for short) is a free and open-source implementation of the Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It provides a "pure Java" HTTP web server environment in which Java code can also ...


References

*Hadley, Marc and Paul Sandoz, eds. (September 17, 2009).
JAX-RS: Java API for RESTful WebServices
' (version 1.1),
Java Community Process The Java Community Process (JCP), established in 1998, is a formalized mechanism that allows interested parties to develop standard technical specifications for Java technology. Anyone can become a JCP Member by filling a form available at thJCP we ...


External links

*
Website estimated cost


Tutorials

* https://javabrains.io/courses/javaee_jaxrs/ * http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html * http://www.vogella.com/tutorials/REST/article.html * http://www.mkyong.com/tutorials/jax-rs-tutorials/ * http://www.coderpanda.com/jax-rs-tutorial/ * https://www.javavogue.com/2015/03/java-jerseyjax-rs-tutorials/ * http://howtodoinjava.com/restful-web-service/ {{Jakarta RESTful Web Services Java enterprise platform Java API for XML Web service specifications