♠ Posted by
Java Tutorials
at
10:22 PM
REST is an architectural style which was brought in
by Roy Fielding in 2000 in his doctoral thesis.
In the web services terms, Representational State Transfer (REST) is a stateless client-server architecture in which the web services are viewed as resources and can be identified by their URIs. Web service clients that want to use these resources access via globally defined set of remote methods that describe the action to be performed on the resource.
It consists of two components REST server which provides access to the resources and a REST client which accesses and modify the REST resources.
In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.REST isn't protocol specific, but when people talk about REST they usually mean REST over HTTP.
The response from server is considered as the representation of the resources. This representation can be generated from one resource or more number of resources.
In the web services terms, Representational State Transfer (REST) is a stateless client-server architecture in which the web services are viewed as resources and can be identified by their URIs. Web service clients that want to use these resources access via globally defined set of remote methods that describe the action to be performed on the resource.
It consists of two components REST server which provides access to the resources and a REST client which accesses and modify the REST resources.
In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.REST isn't protocol specific, but when people talk about REST they usually mean REST over HTTP.
The response from server is considered as the representation of the resources. This representation can be generated from one resource or more number of resources.
REST allows
that resources have different representations, e.g.xml, json etc. The rest
client can ask for specific representation via the HTTP protocol.
1. HTTP methods :
RESTful web services use HTTP protocol methods for
the operations they perform.Methods are:
·
GET:It defines a reading access
of the resource without side-effects.This operation is idempotent i.e.they can
be applied multiple times without changing the result
·
PUT : It creates a new
resource.It must also be idempotent.
·
DELETE : It removes the resources.
The operations are idempotent i.e. they can get repeated without leading to
different results.
·
POST : It updates an existing
resource or creates a new resource.
2. Features of RESTful web services:
Resource identification through URI:Resources are identified by
their URIs (typically links on internet). So, a client can directly access a
RESTful Web Services using the URIs of the resources (same as you put a website
address in the browser’s address bar and get some representation as response).
Uniform interface: Resources are manipulated
using a fixed set of four create, read, update, delete operations: PUT, GET,
POST, and DELETE.
Client-Server: A clear separation
concerns is the reason behind this constraint. Separating concerns between the
Client and Server helps improve portability in the Client and Scalability of
the server components.
Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.
Cache: to improve network efficiency responses must be capable of being labeled as cacheable or non-cacheable.
Named resources : the system is comprised of resources which are named using a URL.
Interconnected resource representations : the representations of the resources are interconnected using URLs, thereby enabling a client to progress from one state to another.
Layered components - intermediaries, such as proxy servers, cache servers, gateways, etc, can be inserted between clients and resources to support performance, security, etc.
Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others.
Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.
Cache: to improve network efficiency responses must be capable of being labeled as cacheable or non-cacheable.
Named resources : the system is comprised of resources which are named using a URL.
Interconnected resource representations : the representations of the resources are interconnected using URLs, thereby enabling a client to progress from one state to another.
Layered components - intermediaries, such as proxy servers, cache servers, gateways, etc, can be inserted between clients and resources to support performance, security, etc.
Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others.
0 comments :
Post a Comment