JAX-RS
Encyclopedia
JAX-RS: Java API for RESTful Web Services is a Java programming language
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

 that provides support in creating web service
Web service
A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...

s according to the Representational State Transfer
Representational State Transfer
Representational state transfer is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term representational state transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation...

 (REST) architectural style. JAX-RS uses annotation
Java annotation
An annotation, in the Java computer programming language, is a special form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and packages may be annotated...

s, introduced in Java SE 5
Java Platform, Standard Edition
Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use...

, 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
Java Platform, Enterprise Edition
Java Platform, Enterprise Edition or Java EE is widely used platform for server programming in the Java programming language. The Java platform differs from the Java Standard Edition Platform in that it adds libraries which provide functionality to deploy fault-tolerant, distributed, multi-tier...

 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
Deployment Descriptor
A deployment descriptor 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 should be deployed...

 is required.

Specification

JAX-RS provides some annotations to aid in mapping a resource class (a POJO
Pojo
Pojo may refer to:* Pohja, the Swedish name for the Finnish municipality* POJO, abbreviation of Plain Old Java Object in computer programming...

) as a web resource. The annotations include:
  • @Path specifies the relative path for a resource class or method.
  • @GET, @PUT, @POST, @DELETE and @HEAD specify the HTTP request type of a resource.
  • @Produces specifies the response MIME
    MIME
    Multipurpose Internet Mail Extensions is an Internet standard that extends the format of email to support:* Text in character sets other than ASCII* Non-text attachments* Message bodies with multiple parts...

     media types.
  • @Consumes specifies the accepted request 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 parameter to a path segment.
  • @QueryParam binds the parameter to the value of an HTTP query parameter.
  • @MatrixParam binds the parameter to the value of an HTTP matrix parameter.
  • @HeaderParam binds the parameter to an HTTP header value.
  • @CookieParam binds the parameter to a cookie value.
  • @FormParam binds the parameter to a form value.
  • @DefaultValue specifies a default value for the above bindings when the key is not found.

JAX-RS 2.0

In January 2011 the JCP formed an expert group http://jcp.org/en/jsr/detail?id=339 to work on JAX-RS 2.0. The main targets are (among others) a common client API and support for Hypermedia following the HATEOAS
HATEOAS
HATEOAS, an abbreviation for Hypermedia as the Engine of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia...

-principle of REST
Rest
Rest may refer to:* Leisure* Human relaxation* SleepRest may also refer to:* Rest , a pause in a piece of music* Rest , the relation between two observers* Rest , a 2008 album by Gregor Samsa...

. The reference implementation will be provided by the team surrounding Oracle
Oracle Corporation
Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

's Paul Sandoz, after the former specification lead Marc Hadley had left Oracle shortly before. Public release (GA) is planned for spring 2012.

Implementation

Implementations of JAX-RS include:
  • Apache CXF
    Apache CXF
    Apache CXF is an open-source, fully featured Web services framework. It originated as the combination of two open-source projects: Celtix developed by IONA Technologies and XFire developed by a team hosted at Codehaus. These two projects were combined by people working together at the Apache...

    , an open source Web service
    Web service
    A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...

     framework.
  • Jersey, the reference implementation from Sun
    Sun Microsystems
    Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

     (now Oracle
    Oracle Corporation
    Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

    ).
  • RESTEasy, JBoss
    JBoss
    JBoss Application Server is an open-source Java EE-based application server. An important distinction for this class of software is that it not only implements a server that runs on Java, but it actually implements the Java EE part of Java...

    's implementation.
  • Restlet
    Restlet
    Restlet is a lightweight, comprehensive, open source REST framework for the Java platform. Restlet is suitable for both server and client Web applications. It supports major Internet transport, data format, and service description standards like HTTP and HTTPS, SMTP, XML, JSON, Atom, and WADL...

    , created by Jerome Louvel, a pioneer in REST frameworks.
  • Apache Wink
    Apache Wink
    Apache Wink is an open source framework that enables development and consumption of REST style web services.- History :The project was initiated in 2007 as an HP internal REST SDK called Symphony...

    , Apache Software Foundation
    Apache Software Foundation
    The Apache Software Foundation is a non-profit corporation to support Apache software projects, including the Apache HTTP Server. The ASF was formed from the Apache Group and incorporated in Delaware, U.S., in June 1999.The Apache Software Foundation is a decentralized community of developers...

    Incubator project, the server module implements JAX-RS.

Jersey

According to the Java EE 6 Tutorial, Volume 1: Jersey is Sun's production quality reference implementation for JSR 311: JAX-RS: The Java API for RESTful Web Services. Jersey implements support for the annotations defined in JSR-311, making it easy for developers to build RESTful web services with Java and the Java JVM. Jersey also adds additional features not specified by the JSR.

External links


See also

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK