The Web Core Ideas and Technologies Resources and Objects (and Services tomorrow) HTTP MIME Types URIs ReST.

Slides:



Advertisements
Similar presentations
Pierre-Johan CHARTRE Java EE - JAX-RS - Pierre-Johan CHARTRE
Advertisements

HTTP and Apache Roy T. Fielding eBuilt, Inc. The Apache Software Foundation
XPointer and HTTP Range A possible design for a scalable and extensible RDF Data Access protocol. Bryan Thompson draft Presented to the RDF.
System Wide Information Management (SWIM)
REST - Representational State Transfer
REST Vs. SOAP.
REST Introduction 吴海生 博克软件(杭州)有限公司.
Introduction to Web Services
REST &.NET James Crisp.NET Practice Lead ThoughtWorks Australia.
REST (Representational State Transfer)
Reinventing using REST. Anything addressable by a URI is called a resource GET, PUT, POST, DELETE WebDAV (MOVE, LOCK)
CS 4720 RESTfulness CS 4720 – Web & Mobile Systems.
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
The Web Core Ideas and Technologies
CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
Building RESTful Interfaces
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
1 The HyperText Transfer Protocol: HTTP Nick Smith Stuart Alley Tara Tjaden.
Definitions, Definitions, Definitions Lead to Understanding.
Controling instrument in the RESTful way
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Web Architecture & Services (2) Representational State Transfer (REST)
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Wyatt Pearsall November  HyperText Transfer Protocol.
Web HTTP Hypertext Transfer Protocol. Web Terminology ◘Message: The basic unit of HTTP communication, consisting of structured sequence of octets matching.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Lecture 6: Sun: 8/5/1435 Distributed Applications Lecturer/ Kawther Abas CS- 492 : Distributed system & Parallel Processing.
1 Seminar on Service Oriented Architecture Principles of REST.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Web Technologies Lecture 1 The Internet and HTTP.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
RESTful Web Services What is RESTful?
REST By: Vishwanath Vineet.
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
Computer Networks with Internet Technology William Stallings Chapter 04 Modern Applications 4.1 Web Access - HTTP.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
Representational State Transfer COMP6017 Topics on Web Services Dr Nicholas Gibbins –
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
What’s Really Happening
National College of Science & Information Technology.
Hypertext Transfer Protocol (HTTP) COMP6218 Web Architecture Dr Nicholas Gibbins –
How HTTP Works Made by Manish Kushwaha.
RESTful Sevices Distributed Objects Presented by: Shivank Malik
HTTP – An overview.
Hypertext Transfer Protocol
Web Development Web Servers.
REST- Representational State Transfer Enn Õunapuu
Advanced Web-based Systems | Misbhauddin
Hypertext Transfer Protocol
Introduction Web Environments
Web Caching? Web Caching:.
Representational State Transfer
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
WEB API.
REST APIs Maxwell Furman Department of MIS Fox School of Business
REST på Microsoft-stacken
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
A gentle introduction to RESTful APIs
CSCI-351 Data communication and Networks
Chengyu Sun California State University, Los Angeles
REST API Design Borrowed heavily from:
Presentation transcript:

The Web Core Ideas and Technologies Resources and Objects (and Services tomorrow) HTTP MIME Types URIs ReST

Uniform Access - HTTP Main access/manipulation protocol of the Web A means of exchanging resource representations across the network Request/response based interactions Supports a limited number of requests GET – retrieve a resource – no payload POST – send a resource to a server – payload PUT – update or alter a resource on a server - payload If the resource does not exist, the server may allow the resource to be created DELETE – remove a resource from a server – no payload HEAD – find out what metadata you would get back if you performed a GET – no payload OPTIONS – find out what operations are permitted on a resource – no payload

HTTP When a server receives a request, it returns a response containing a response code, headers and possibly a resource representation. Codes are divided into types 100 – 199 – informational 200 – 299 – success 300 – 399 – redirect 400 – 499 – client error 500 – 599 – server error examples: 200 OK 201 Created 403 Forbidden 301 Redirect (with ‘Location’ header) 500 Internal Server Error

HTTP Headers The HTTP message is an envelope starts with headers Then the body (payload), if any. request: GET /weather/ HTTP/1.1 Host: User-Agent: curl/ Accept: */* response: HTTP/ OK Server: Apache/ (Unix) Content-Length: Content-Type: text/html …payload…

MIME Multipurpose Internet Mail Extensions not used just in now The Content-Type header field points to a MIME Type A (slowly growing) list of known media types text/plain text/xml text/html image/gif image/jpeg Developers/designers are encouraged to reuse MIME types keeping the list manageable helps interoperability A different approach to Object interfaces

Common HTTP Headers Host: the target host Content-Length: length (in bytes) of the resource representation Content-Type: MIME type of representation Accept: Accepted MIME type Transfer-Encoding: can be chunked. This means the data is sent in chunks, rather than all in one go. Useful for data for which the length is not known when starting transmission. Content-Encoding: e.g. gzip, deflate. Allows zipping up content. Etag: a server defined ID for a resource If-Match, If-None-Match: allows conditional requests Date: If-Modified-Since, If-Not-Modified: allows conditional requests Expect: e.g. 100-continue: server responds with a 100 status code if the client should continue with the request by sending the payload. WWW-Authenticate: authentication challenge issued by a server Many Caching-related headers

HTTP Headers are extensible Typically start with ‘X-’ Allows application specific metadata Examples from Rackspace: X-Auth-User – user name in request X-Auth-Key – user API key in request X-Auth-Token – user token with lifetime in response Mobiles: x-roaming - is the user roaming? x-nokia-msisdn – user’s mobile number in plain text HTTP_X_BROWSER_HEIGHT HTTP_X_DEVICE_TYPE Even: HTTP_X_ME_CUSTOM_ITEM_1

Uniform Naming - URIs Uniform Resource Identifier An identifier for a resource on the Web. A superset comprising URNs (Uniform Resource Name) and URLs (Uniform Resource Location). URLs can be dereferenced (i.e. they represent an ‘address’) Examples: urn:isbn: urn:jxta:uuid: A F3BC76 The first is a URL - it represents an address - you can GO there - PPT spotted that The second is a URN - it identifies a book uniquely The third is a URN, but using the Jxta Protocol, one may be able to resolve this to a URL. PPT obviously does not support Jxta.

URIs URIs can be either hierarchical or non-hierarchical. A non hierarchical URI is considered opaque. A hierarchical URI has a number of elements. All URIs start with a scheme element This example is hierarchical: schemehostportpathfragment This example is not hierarchical: scheme opaque authority

Resources and URIs Hierarchical URIs can also have a query string: keyvalue This is a simplified URI generated by searching Google for the word “web” q is a key to google to say the bit of the query after the = is what I typed in. Query strings can contain multiple key/value pairs using an ampersand ?client=safari&rls=en-us&q=web&ie=UTF-8&oe=UTF-8 Experiment - change the value after the q=. Add &hl=ja to the end of the URI and see what happens

Resources and URIs Resources have state but not operations over that state. This is supported through URIs The scheme of the URI determines the operations permitted on a resource. By exposing representations of resources at URIs with different schemes, you offer different operations on that resource.

Representational State Transfer (ReST) Term coined by Roy Fielding in his PhD dissertation in 2000 A PhD thesis that has actually had an impact!!! ReST is an architectural style derived from looking at the Web and what makes it scalable It is a client/server architectural style in which clients retrieve representations of resources. When a new resource is retrieved, the state of the client, e.g., the browser, is changed. The term is now heavily used and misused ReST != HTTP Not all the Web is ReSTful

ReST Primary constraints Client/server Request/response Statelessness interactions are stateless Caching reduces network load HTTP headers support lots of caching policies Uniform Interface URIs HTTP MIME types Layering Allows servers to act as gateways to areas of the network for firewalling, caching Allows evolution of parts of the network to happen incrementally without affecting the whole network Code-on-Demand e.g. Applets, SWF

Statelessness Interactions on the Web are usually stateless Resources have (represent) state, but the interactions do not When I query Google, each query happens in isolation. There is no state preserved at the server regarding my query, even if I move through a number of results pages Experiment: add &start=20 to the end of your query What happens? You move to a new URI which is independent of the previous URI. (Look at the Gooooooogle links at the bottom of the page) The Cookie is typically used to represent interaction state Cookie Header is an opaque pointer to state Stored at the client Understood by the server – the state of interactions is on the server – not ReSTful

Caching and Linkability Caching Allows resources to be stored and retrieved locally, or closer to the source of the request This saves on bandwidth Is a form of load balancing Is possible because of the resource abstraction. Caching also applies to storage outside of the Web via URIs - in desktop applications, on TV, newspapers, billboards, human memory Linkability Web Architecture (Vol 1): It is a strength of Web Architecture that links can be made and shared; a user who has found an interesting part of the Web can share this experience just by republishing a URI. Makes the Web a web

Caching and Linkability Linkability and cacheability are achievable through two primary qualities URIs being ‘addressable’ I can share them, publish them knowing others will get the same result as me when they de-reference the URI. A certain longevity to URIs - If I link to a resource today, will it still be there tomorrow? Safe and idempotent interactions Safe interactions are those with no side-effects. the user is not to be held accountable for the result of the interaction. I am not entering into a contract or agreeing to terms and conditions when I follow a link. If this were the case, how could you be sure that you were not at a deeper level within the domain, having unknowingly bypassed the terms an conditions page? – Servers use redirects for this. Idempotent interactions. No matter how many times the identical request is repeated, it does not change the side-effects of the request.

Uniform Interface separation of resource from representation What you see is not the actual thing, but a representation. Things may have multiple representations. manipulation of resources by representations Changing the representation may induce a change in the state of the resource itself self-descriptive messages Allows each message to be independent No need to track state changes across multiple exchanges hypermedia as the engine of application state (?) Hypermedia is a medium that allows non-linear progression through states. A page with links - its up to you where you go. So state is only perceived and controlled by the client

URL Every GET to Google is independent. Google doesn’t perceive your state changes Possible next states The client chooses the next state Only the client percieves the continuum of states “Hypermedia as the engine of application state”

Conclusion The Web core concepts Uniform Access HTTP Naming URIs Representation MIME types primarily HTML ReST stateless interactions caching state at the client side