Introdcution
JAX-RS is API specification for RESTful web services using Java. RESTful web services is implementation of REST (Representational State Transfer) which is architectural design for distributed system or in general we can say JAX-RS is a set of APIs to develop REST service.
This is a brief introduction about REST and JAX-RS. You can find more information on REST on Wiki and JAX-RS Official Site.
What is REST
Representational state transfer is an abstraction of the architecture of the World Wide Web. More precisely, REST is an architectural style consisting of a coordinated set of architectural constraints (source Wikipedia)
As JAX-RS is only a specification, we need to use it’s implemented library to create RESTful web service.
Following are such list of libraries
- Apache CXF, an open source Web service framework.
- Jersey, the reference implementation from Sun (now Oracle).
- RESTeasy, JBoss’s implementation.
- Restlet, created by Jerome Louvel, a pioneer in REST frameworks
- Apache Wink, Apache Software Foundation Incubator project, the server module implements JAX-RS.
For this JAX-RS tutorials set we will use Jersey
library and Maven for dependency management.
Quick Start
Following are some start-up JAX-RS examples.
-
Simple Hello World Example
simple JAX-RS tutorial, which sends “Hello World” text as response string using JAX-RS API and Jersey implementation.
-
JSON Response Example