Saturday, April 16, 2011

REST FUL WebServices

Overview

REST is an architectural style which is based on web-standards and the HTTP protocol. REST was first described by Roy Fielding in 2000.

In a REST based architecture everything is a resource. A resource is accessed via a common interface based on the HTTP standard methods. In an REST 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 ID's (which are typically URIs). For eg. In Facebook API resources like information pertaining to a person or group can be accessed through there global ID's.


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).


HTTP methods

The HTTP standards methods which are typical used in REST are PUT, GET, POST, DELETE.

So what the heck Restful Web services is ?

A RESTFul webservices is based on the HTTP methods and the concept of REST. It typically defines the base URI for the services, the MIME-types its supports (XML, Text, JSON, user-defined,..) and the set of operations (POST, GET, PUT, DELETE) which are supported. JAX-RS supports the creation of XML and JSON via JAXB

Java defines standard REST support via JAX-RS (The Java API for RESTful Web Services) in JSR 311 .JAX-RS uses annotations to define the REST relevance of classes.

This servlet which analyze the incoming HTTP request and select the correct class and method to respond to this request. This selection is based on annotation in the class and methods.

Ok Wait... You author everytime you come up with a new thing . Now what's this annotation.

Annotation:


Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate.

More details by Oracle are here

I think it's ok for today... Wait for the next delivery... Till then watch Indian Premier League.

No comments:

Post a Comment