Wednesday, February 27, 2013

REST and HTTP : Origin of REST

REST  an acronym for 'Representational State Transfer' seems to the latest sensation for web services development. With 'World Wide Web' expanding to gigantic proportions, better and ever expanding internet bandwidth speed, exponential surge in the mobile users across the globe, all of which have propelled companies to move from 'Product' paradigm to a 'Cloud' deployment paradigm.

Evolution of REST as web services concept has its root in inception of 'World Wide Web' and hence evolution of HTTP itself.

Tim Berners-Lee's 'World Wide Web'


Way back in 1990 Tim Berners-Lee envisaged -
"The WorldWideWeb (W3) is a wide-area hypermedia information retrieval initiative
aiming to give universal access to a large universe of documents."
 This project, he named, 'WorldWideWeb' , for sharing of knowledge and data between sever and client. Within a year he has implemented a new web architecture :
  • The Uniform Resource Identifier (URI), a syntax that assigns each web document a unique address
  • The HyperText Transfer Protocol (HTTP), a message-based language that computers could use to communicate over the Internet
  • The HyperText Mark-up Language (HTML), to represent informative documents that contain links to related documents
  • The first web server
  • The first web browser, which Berners-Lee also named “WorldWideWeb” and later renamed “Nexus” to avoid confusion with the Web itself
  • The first WYSIWYG§ HTML editor, which was built right into the browser.
Web traffic, over the time , started expanding exponentially, outgrowing the then Internet infrastructur. Web protocols, particularly support for caches, were not used to their optimum capacity. Web's scalability problem eventaully became a cause of worry among the concerned people.

Roy Fielding's New Web Architecture


 Roy Fielding, co-founder of the Apache HTTP Server Project, project a new Web Architecture with following constraints while leaving the implementation free to design
  • Client - Server - This assigns a separate and independent roles to client and server. This separation allows clients and servers to remain 'detached' from each other. They would rather interact with each other through a common interface. This 'Uniform Interface' would give flexibility to the server so that applications could be deployed across different machines with different technologies.
  • Uniform Interface - Interaction between client , server and any intermediate application would take place through a 'Uniform Interface'. This decouples the different web components and allows them to grow independently. This is defined by four constraints 
    • Indentification of Resource and Resource identifiers - A resource is an abstract word to represent a node of information that can be accessed and/or modified by a web component, such as a client.For e.g it could be a file, document  or a collection of othere resources. "More precisely, a resource R is a temporally varying membership function MR(t), which for time t maps to a set of entities, or values, which are equivalent. The values in the set may be resource representations and/or resource identifiers ".             For example, the "get the last entry of my collection" is a mapping whose value ( last entry ) changes over time, assuming 'my collection' gets modified over time, whereas a mapping to "No of years Mahatma Gandhi lived" is static. Resource Identifiers  is an URI ( Uniform Resource Identifier )  to identify a particular resource on the server.
    • Resource Representation - Clients perform actions on a resource by using a representation of the resource. This representation is the intended/desired state required by the client. A representation consists of  data or message, which is a sequence of bytes, together with the metadata to describe those bytes.A resource may have multiple representation. A HTML document, a PDF document or an Image file, etc are some examples for different resource representation
      • Control data - It defines the purpose of the message such as the action being requested or request parameters to override some default behaviour. E.g cache-control
      • Resource Representation Metadata - This defines additional information for different resource representation, send in the request by the client or send in the response by the server. HTTP headers are used to represent  the metadata like content-type of the data, language, media type
      • Resource Metadata - This defines additional information for resource which is different from the Resource Representation, such as Location, source link, date
    •  Connectors - Connectors manage network communications for a web component. They encapsulate the activities of accessing resources and transferring resource representations.Different connector types are :
      • Client - This initiates a communication by making a request
      • Server - This listens to the requests from different client and sends a response
      • Cache - This  saves cacheable responses to current interactions so that they can be reused for later requested interactions. They are located on either the client interfaces or the server.
      • Resolver - A resolver translates partial or complete resource identifiers into the network address information needed to establish an inter-component connection, such as  DNS resolvers. 
      • Tunnel - This simply relays communication across a connection boundary, such as a firewall or lower-level network gateway.

                      >> page 2                                                        >> page 2                                                                     


No comments:

Post a Comment