REST (Representational State Transfer) is an architectural style which is based on web-standards and the HTTP protocol.
In a REST based architecture everything is a resource. A resource is accessed via a common interface based on the HTTP standard methods. In a REST based architecture you typically have a REST server which provides access to the resources and a REST client which accesses and modify the REST resources. Every resource should support the HTTP common operations. Resources are identified by global IDs. REST allows that resources have different representations, e.g. text, xml, json etc. The rest client can ask for specific representation via the HTTP protocol (content negotiation).
The PUT, GET, POST and DELETE methods are typical used in REST based architectures.
- GET defines a reading access of the resource without side-effects. The resource is never changed via a GET request, e.g. the request has no side effects (idempotent).
- PUT creates a new resource, must also be idempotent.
- DELETE removes the resources. The operations are idempotent, they can get repeated without leading to different results.
- POST updates an existing resource or creates a new resource.
RESTFul webservices are based on the HTTP methods and the concept of REST. A RESTFul webservice typically defines the base URI for the services, the supported MIME-types (XML, Text, JSON, user-defined) and the set of operations (POST, GET, PUT, DELETE) which are supported.
Java defines REST support via the Java Specification Request 311 (JSR). This specificiation is called JAX-RS (The Java API for RESTful Web Services). JAX-RS uses annotations to define the REST relevance of Java classes.
I suggest to read the following two article before start learing the REST (JAX-RS) web service. I wrote these articles keeping in mind atleast you get a over all idea of web service.
Before Learning Java Web Service
XML Parsing using Java
1. JAX-RS With GlassFish Jersey
2. JAX-RS With Jboss RESTEasy
3. JAX-RS With Apache CXF
4. Spring And Jersey
5. Spring and RESTEasy
6. Spring And CXF
7. RESTful Web Service with Spring 3.1
8. @Path - JAX-RS
9. @PathParam - JAX-RS
10. @RequestParam - JAX-RS
In this article I have not completed all the topics.. There are lot more techniques and tricks in RESTful web services. I was going through Spring 3.1.0 developer docs and it is pretty good from understanding point of view. So I would suggest you to refer Spring 3.1.0 or some other implementations of JAX-RS for a much better knowledge. I am short of time and next I will be working towards some modern technologies, so that I can get you some implementation for what I posted last week in my article Architecture of a Modern Web Application.
0 comments:
Post a Comment