COMS E6125 Web-enHanced Information Management (WHIM)

Slides:



Advertisements
Similar presentations
REST - Representational State Transfer
Advertisements

REST Vs. SOAP.
REST Introduction 吴海生 博克软件(杭州)有限公司.
Building RESTful Interfaces
Technical Architectures
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
What is adaptive web technology?  There is an increasingly large demand for software systems which are able to operate effectively in dynamic environments.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
COMPUTER TERMS PART 1. COOKIE A cookie is a small amount of data generated by a website and saved by your web browser. Its purpose is to remember information.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
FIREWALL TECHNOLOGIES Tahani al jehani. Firewall benefits  A firewall functions as a choke point – all traffic in and out must pass through this single.
INTRODUCTION TO WEB DATABASE PROGRAMMING
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,
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
JavaScript, Fourth Edition
An Introduction to Software Architecture
World Wide Web Hypertext model Use of hypertext in World Wide Web (WWW) WWW client-server model Use of TCP/IP protocols in WWW.
Web HTTP Hypertext Transfer Protocol. Web Terminology ◘Message: The basic unit of HTTP communication, consisting of structured sequence of octets matching.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Unit – I CLIENT / SERVER ARCHITECTURE. Unit Structure  Evolution of Client/Server Architecture  Client/Server Model  Characteristics of Client/Server.
Web Technologies Interactive Responsiveness Function Hypertext Web E-Publishing Simple Response Web Fill-in Forms Object Web « Full-Blown » Client/Server.
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
HTTP evolution - TCP/IP issues Lecture 4 CM David De Roure
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
AMQP, Message Broker Babu Ram Dawadi. overview Why MOM architecture? Messaging broker like RabbitMQ in brief RabbitMQ AMQP – What is it ?
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
RESTful Web Services What is RESTful?
REST By: Vishwanath Vineet.
06 March 2007COMS E61251 COMS E6125 Web-enHanced Information Management (WHIM) Prof. Gail Kaiser Spring 2007.
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.
6/28/ A global mesh of interconnected networks (internetworks) meets these human communication needs. Some of these interconnected networks are.
National College of Science & Information Technology.
12. DISTRIBUTED WEB-BASED SYSTEMS Nov SUSMITHA KOTA KRANTHI KOYA LIANG YI.
Distributed Systems Architectures Chapter 12. Objectives  To explain the advantages and disadvantages of different distributed systems architectures.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Web fundamentals: Clients, Servers, and Communication
Web Engineering CS-4513 Prepared By: Junaid Hassan Lecturer at UOS M.B.Din Campus
How HTTP Works Made by Manish Kushwaha.
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 14: System Protection
Web Development Web Servers.
REST- Representational State Transfer Enn Õunapuu
Software Design and Architecture
Distribution and components
Distributed web based systems
Web Caching? Web Caching:.
Processes The most important processes used in Web-based systems and their internal organization.
Representational State Transfer
PHP / MySQL Introduction
Service-centric Software Engineering
Ashish Pandit, Louis Zelus, Jonathan Whitman
Client side & Server side scripting
Lecture 1: Multi-tier Architecture Overview
Objective Understand web-based digital media production methods, software, and hardware. Course Weight : 10%
Chapter 20 Object-Oriented Analysis and Design
Software models - Software Architecture Design Patterns
An Introduction to Software Architecture
Service-Oriented Computing: Semantics, Processes, Agents
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Chapter 2: Operating-System Structures
William Stallings Data and Computer Communications
WebDAV Design Overview
RESTful Web Services.
REST på Microsoft-stacken
Chapter 2: Operating-System Structures
Presentation transcript:

COMS E6125 Web-enHanced Information Management (WHIM) Prof. Gail Kaiser Spring 2012 7 February 2012 Kaiser: COMS E6125

Today’s Topic: REST Architectural Style 7 February 2012 Kaiser: COMS E6125

What Do We Mean By Architecture? A software architecture investigates and determines methods for how best to partition a system, how components identify and communicate with each other, how information is communicated, how elements of a system can evolve independently, and how all of the above can be described using formal and informal notations 7 February 2012 Kaiser: COMS E6125

What Do We Mean By Architectural Style? Common pattern across system architectures A named, coordinated set of architectural constraints (analogous to “design patterns”) Example architectural styles: client-server, N-tier, peer-to-peer, pipes, plugin One system may be composed of multiple styles Some styles are hybrids of other styles REST (REpresentational State Transfer) introduces an architectural style for Web applications 7 February 2012 Kaiser: COMS E6125

Why “Representational State Transfer”? Intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through the application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user agent, and rendered for use 7 February 2012 Kaiser: COMS E6125

REST Fundamentals Resources Representations of resources Communication to obtain/modify representations Web “page” as an instance of an application’s state Engines to move from one state to the next (browser, spider, any media type handler) 7 February 2012 Kaiser: COMS E6125

What is a Resource? A resource can be anything that has identity a document or image a service, e.g., informing “today’s weather in Seattle” a collection of other resources non-networked objects (e.g., people) The resource is the conceptual mapping to an entity or set of entities, not necessarily the entity that corresponds to that mapping at any particular point in time 7 February 2012 Kaiser: COMS E6125

Representations of a Resource The Web is designed to manipulate and transfer representations of a resource (not the actual resource) A single resource may be associated with multiple representations (content negotiation) A representation is in the form of a media type that provides meta-data information for this resource Hypermedia-aware media types provide potential state transitions Most representations are cacheable 7 February 2012 Kaiser: COMS E6125

A Resource is Defined by a URI http://www.domain.com/name/of/resource?limit=10&offset=0#bookmark Part Sample Meaning scheme http Protocol used to communicate with the resource host www.domain.com Server on which resource is located path /name/of/resource Determines precise resource on server query limit=10&offset=0 Instructs server how to apply additional operations to the resource fragment bookmark Not transmitted to server, only applied client-side

Resource Operations Once the resource has been reached, it needs to be acted upon Four simple verbs: GET, PUT, POST, DELETE GET – read or query, no side-effects, cacheable, searchable PUT and DELETE – atomically alter the state of the entire resource POST – very generic, may alter internal state or behave like a remote procedure call 7 February 2012 Kaiser: COMS E6125

Representational State Transfer GET – transfers some representation from the server to the client, changing the state of the client (but not the server) GET - Following a link in the representation transfers the client to another state PUT, DELETE – transfers some representation from the client to the server, changing the state of the server POST – transfers some content to the server, changing the state of the server 7 February 2012 Kaiser: COMS E6125

Example RESTful API https://dev.twitter.com/docs/api 7 February 2012 Kaiser: COMS E6125

Representational State Transfer Optimized for transfer of typed data streams Caching of representations allows application interaction to proceed without using the network 7 February 2012 Kaiser: COMS E6125

Origin Server Model Server provides interface to services as a resource hierarchy Implementation details hidden from clients Stateless interaction for scalability Application interaction can be spread across multiple servers Replaceable by a gateway pipe 7 February 2012 Kaiser: COMS E6125

Gateway Model Appears as a normal origin server to client Provides an interface encapsulating other services - data flow translation in both directions Also used for high-speed caching 7 February 2012 Kaiser: COMS E6125

Agent Model Holds all application state which allows user to manipulate it (history) or anticipate changes to it (link maps) Application details hidden from server browser, spider, index robot, personal agent Replaceable by a proxy pipe 7 February 2012 Kaiser: COMS E6125

Proxy Model Translate multiple services into HTTP Transform data streams according to client limitations (e.g., image translation) Enforce security policies Enable shared caching 7 February 2012 Kaiser: COMS E6125

Representational State Transfer Optimized for transfer of typed data streams Caching of representations allows application interaction to proceed without using the network 7 February 2012 Kaiser: COMS E6125

Where Did REST Come From? Defined in Roy Fielding’s PhD thesis (University of California at Irvine, 2000) Who is this Roy Fielding? Co-author of HTTP/1.0, URI standards First author of HTTP/1.1 standard Co-Founder of Apache Now Chief Scientist of Day content management company 7 February 2012 Kaiser: COMS E6125

Questions Fielding’s thesis tried to answer How do we introduce a new set of functionality to an architecture that is already widely deployed? How do we ensure that its introduction does not adversely impact, or even destroy, the architectural properties that have enabled it to succeed? 7 February 2012 Kaiser: COMS E6125

REST is a Network Application Architecture Communication is restricted to message passing Defines how system components are allocated and identified how the components interact to form a system the amount and granularity of communication needed for interaction interface protocols Usually highly concerned with performance issues 7 February 2012 Kaiser: COMS E6125

Network Performance Measures Latency latent period: time between stimulus and first indication of a response minimum latency = ping/echo time Throughput rate of data transfer Round trips number of interactions per user action 7 February 2012 Kaiser: COMS E6125

Network Performance Measures Overhead setup: time to enable application-level interaction message control Amortization spreading overhead across many interactions Completion = setup / amortization + (roundtrips * latency) + (control + data) / throughput 7 February 2012 Kaiser: COMS E6125

User-perceived Performance User-perceived latency impacted by setup overhead network distance x round trips blocking/multithreading collisions User-perceived throughput impacted by available network bandwidth message control overhead message buffering, layer mismatches 7 February 2012 Kaiser: COMS E6125

REST Goals Scalability of component interactions Generality of interfaces Independent deployment of components Intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems REST Goals derived (in part) from original Web Requirements 7 February 2012 Kaiser: COMS E6125

Low Entry-Barrier For readers, authors and application developers All protocols defined as text, so communication can be viewed and interactively tested using existing network tools Enabled early adoption of the protocols to take place despite lack of standards 7 February 2012 Kaiser: COMS E6125

Simple and general hypermedia user interface Same interface can be used regardless of the information source Flexibility of hypermedia relationships (links) allows for unlimited structuring Direct manipulation of links allows complex relationships within the information to guide the reader through an application Since information within large databases often easier to access via search rather than browsing, can also perform simple queries by providing user-entered data to a service and rendering the result as hypermedia 7 February 2012 Kaiser: COMS E6125

Partial availability must not prevent content authoring Authoring language needed to be simple and created using existing editing tools Unavailability of some referenced information, either temporarily or permanently, should not prevent the reading and authoring of available information Create references to information before the target of that reference is available References needed to be easy to communicate, in email directions or written on a napkin 7 February 2012 Kaiser: COMS E6125

Extensibility Avoid getting stuck forever with the limitations of what was initially deployed Requirements change over time 7 February 2012 Kaiser: COMS E6125

Minimize Latency Hypermedia involves application control information embedded within (or as a layer above) presentation information, which in distributed case may be stored at remote locations User actions require transfer of large amounts of data from where stored to where used Usability highly sensitive to user-perceived latency: time between selecting a link and rendering of a usable result Thus, must minimize network interactions (round-trips within the data transfer protocols) 7 February 2012 Kaiser: COMS E6125

Internet-scale More than just geographical dispersion Internet interconnects across multiple organizational boundaries 7 February 2012 Kaiser: COMS E6125

Anarchic Scalability Need for architectural elements to continue operating when they are subjected to an unanticipated load, or when given malformed or maliciously constructed data Clients cannot maintain knowledge of all servers Servers cannot retain knowledge of state across requests Data elements cannot retain "back-pointers" for each element that references them 7 February 2012 Kaiser: COMS E6125

Anarchic Scalability Intermediary applications, such as firewalls, should be able to inspect the application interactions and prevent those outside the security policy of the organization Participants should assume that any information received is untrusted, or require additional authentication before trust can be given The architecture must be capable of communicating authentication data and authorization controls Default operation should be limited to actions that do not need trusted data 7 February 2012 Kaiser: COMS E6125

Independent Deployment Be prepared for gradual and fragmented change, where old and new implementations co-exist Architectural elements need to be designed with the expectation that later architectural features will be added Older implementations need to be easily identified so that legacy behavior can be encapsulated without adversely impacting newer elements Ease deployment in a partial, iterative fashion, since it is not possible to force deployment in an orderly manner 7 February 2012 Kaiser: COMS E6125

Fielding’s Approach Use an architectural style to define and improve the design rationale behind the Web's architecture Use that style as the acid test for proving proposed extensions prior to their deployment (acid test = a foolproof test that will accurately determine the validity of something) 7 February 2012 Kaiser: COMS E6125

Start with the “null” Style No distinguished boundaries between components 7 February 2012 Kaiser: COMS E6125

Add Client-Server Emphasizes separation of concerns Separate the user interface (client initiators) from data storage (server listeners) improves portability of the user interface across multiple platforms improves scalability by simplifying the server components (compared to console user interface) Allows components to evolve independently 7 February 2012 Kaiser: COMS E6125

Add Stateless Server Client-server interaction must be stateless in nature each request from client to server must contain all of the information necessary to understand the request cannot take advantage of any stored context on the server Session state is therefore kept entirely on the client 7 February 2012 Kaiser: COMS E6125

Compare to Stateful Server Each client initiates a session on server Application state kept on server Commands are used to exchange data or change session state Flexible, interactive, easy to extend services Scalability is a problem 7 February 2012 Kaiser: COMS E6125

Stateless Issues Visibility improved because a monitoring system does not have to look beyond a single request in order to determine the full nature of the request Reliability improved because eases the task of recovering from partial failures Scalability improved because not having to store state between requests allows the server component to quickly free computing resources Simplifies implementation because the server doesn't have to manage resource usage across requests 7 February 2012 Kaiser: COMS E6125

Stateless Tradeoffs May decrease network performance by increasing the repetitive data (per-interaction overhead) sent in a series of requests, since that data cannot be left on the server in a shared context Placing application state on the client-side reduces the server's control over consistent application behavior, since the application becomes dependent on the correct implementation of semantics across multiple client versions 7 February 2012 Kaiser: COMS E6125

Add Caches Improves network efficiency Requires that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable If cacheable, then client cache is given the right to reuse that response data for later, equivalent requests 7 February 2012 Kaiser: COMS E6125

Cache Tradeoffs Potential to partially or completely eliminate some interactions, improving efficiency, scalability and user-perceived performance by reducing the average latency of a series of interactions Can decrease reliability if stale data within the cache differs significantly from the data that would have been obtained had the request been sent to the server 7 February 2012 Kaiser: COMS E6125

Pre-1994 Web Architecture 7 February 2012 Kaiser: COMS E6125

Pre-1994 Web Architecture Stateless client-server interaction for the exchange of static documents Rudimentary support for non-shared caches Relied on a common client-server implementation library (CERN libwww) to maintain consistency across Web applications 7 February 2012 Kaiser: COMS E6125

But… Developers of Web implementations had already exceeded the early design Requests could identify services that dynamically generated responses, such as image-maps and server-side scripts New intermediary components - proxies and shared caches - required protocol extensions to communicate reliably 7 February 2012 Kaiser: COMS E6125

Add Uniform Interface Apply principle of generality to the component interface, so overall system architecture is simplified and visibility of interactions is improved Implementations are decoupled from the services they provide, which encourages independent evolvability 7 February 2012 Kaiser: COMS E6125

Uniform Interface Tradeoffs Degrades efficiency, since information is transferred in a standardized form rather than one specific to an application's needs Efficient for large-grain hypermedia data transfer, optimizing for the Web common case, but resulting in an suboptimal interface for other architectural interactions 7 February 2012 Kaiser: COMS E6125

Add Layers Constrain component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting Places bound on the overall system complexity and promotes substrate independence 7 February 2012 Kaiser: COMS E6125

Akin to Pipe-and-Filter Data stream is filtered through a sequence of components Components do not need to know identity of peers Components are transitive 7 February 2012 Kaiser: COMS E6125

Layers Issues Encapsulate legacy services Protect new services from legacy clients Simplifies components by moving infrequently used functionality to a shared intermediary 7 February 2012 Kaiser: COMS E6125

Layers Tradeoffs Intermediaries improve system scalability by enabling load balancing of services across multiple networks and processors But add overhead and latency to the processing of data, reducing user-perceived performance Can be offset by shared caching at intermediaries Allows security policies to be enforced on data crossing the organizational boundary, as required by firewalls 7 February 2012 Kaiser: COMS E6125

Add Code-on-Demand Client functionality extended by downloading and executing code in the form of applets or scripts Simplifies clients by reducing features required to be pre-implemented 7 February 2012 Kaiser: COMS E6125

Code-on-Demand Tradeoffs Allowing features to be downloaded after deployment improves system extensibility But also reduces visibility, so this is only an optional constraint of REST 7 February 2012 Kaiser: COMS E6125

Why “Optional”? If all client software within an organization is known to support Java applets, then services within that organization can be constructed such that they gain the benefit of enhanced functionality via downloadable Java classes However, the organization's firewall may prevent the transfer of Java applets from external sources, and thus to the rest of the Web it will appear as if those clients do not support code-on-demand 7 February 2012 Kaiser: COMS E6125

“Optional” Constraints The architecture only gains the benefit (and suffers the disadvantages) of optional constraints when they are known to be in effect for some realm Allows to design an architecture that supports the desired behavior in the general case, but with the understanding that it may be disabled within some contexts 7 February 2012 Kaiser: COMS E6125

REST Architecture Ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements Encompasses the fundamental constraints upon components, connectors and data that define the basis of the Web architecture, and thus the essence of its behavior as a network-based application 7 February 2012 Kaiser: COMS E6125

REST Data Elements When a link is selected, information needs to be moved from the location where it is stored to the location where it will be used - by, in most cases, a human reader Unlike many other distributed processing paradigms, where it is usually more efficient to move the "processing agent" (e.g., mobile code, stored procedure, search expression, etc.) to the data rather than move the data to the processor 7 February 2012 Kaiser: COMS E6125

Three Options Render the data where it is located and send a fixed-format image to the recipient Encapsulate the data with a rendering engine and send both to the recipient Send the raw data to the recipient along with metadata that describes the data type, so that the recipient can choose their own rendering engine 7 February 2012 Kaiser: COMS E6125

Option 1: Traditional Client-Server Style Allows all information about the true nature of the data to remain hidden within the sender, preventing assumptions from being made about the data structure and making client implementation easier But also severely restricts the functionality of the recipient and places most of the processing load on the sender, leading to scalability problems 7 February 2012 Kaiser: COMS E6125

Option 2: Mobile Object Style Provides information hiding while enabling specialized processing of the data via its unique rendering engine But limits the functionality of the recipient to what is anticipated within that engine and may vastly increase the amount of data transferred 7 February 2012 Kaiser: COMS E6125

Option 3 Allows the sender to remain simple and scalable while minimizing the bytes transferred But loses the advantages of information hiding and requires that both sender and recipient understand the same data types 7 February 2012 Kaiser: COMS E6125

REST Hybrid Shared understanding of data types with metadata, but limiting the scope of what is revealed through a standardized interface Components communicate by transferring a “representation” of a resource in a format matching one of an evolving set of standard data types, selected dynamically based on the capabilities or desires of the recipient and the nature of the resource Whether the representation is in the same format as the raw source, or is derived from the source, remains hidden behind the interface 7 February 2012 Kaiser: COMS E6125

REST Hybrid Benefits of the mobile object style are approximated by sending a representation that consists of instructions in the standard data format (e.g., HTML) of an encapsulated rendering engine Gains the separation of concerns of the client-server style without the server scalability problem Allows information hiding through a generic interface to enable encapsulation and evolution of services Provides for a diverse set of functionality through downloadable feature-engines 7 February 2012 Kaiser: COMS E6125

REST Data Elements Resource - the intended conceptual target of a hypertext reference Resource identifier – URL (or URN) Representation - HTML document, JPEG image Representation metadata - media type, last-modified time Resource metadata - source link, alternates Control data - if-modified-since, cache-control 7 February 2012 Kaiser: COMS E6125

REST Resources Any information that can be named can be a resource: a document or image, a temporal service, a collection of other resources, a non-virtual object (e.g., a person) A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time Some resources are static in the sense that, when examined at any time after their creation, they always correspond to the same value set Others have a high degree of variance (dynamic) in their value over time The only thing that is required to be static for a resource is the semantics of the mapping, since the semantics is what distinguishes one resource from another 7 February 2012 Kaiser: COMS E6125

REST Resources Example The "authors' preferred version" of an academic paper is a mapping whose value changes over time, whereas a mapping to "the paper published in the proceedings of conference X" is static These are two distinct resources, even if they both map to the same value at some point in time The distinction is necessary so that both resources can be identified and referenced independently 7 February 2012 Kaiser: COMS E6125

REST Resources Provides generality by encompassing many sources of information without artificially distinguishing them by type or implementation Allows late binding of the reference to a representation, enabling content negotiation to take place based on characteristics of the request Allows an author to reference the concept rather than some singular representation of that concept, thus removing the need to change all existing links whenever the representation changes 7 February 2012 Kaiser: COMS E6125

REST Resource Identifiers Identifies the particular resource REST connectors provide a generic interface for accessing and manipulating the value set of a resource, regardless of how the membership function is defined or the type of software that is handling the request The naming authority that assigned the resource identifier, making it possible to reference the resource, is responsible for maintaining the semantic validity of the mapping over time 7 February 2012 Kaiser: COMS E6125

REST Representations REST components perform actions on a resource by using a representation to capture the current or intended state of that resource and transferring that representation between components A representation is a sequence of bytes (usually a document or file), plus metadata to describe those bytes Metadata is in the form of name-value pairs, where the name corresponds to a standard that defines the value's structure and semantics 7 February 2012 Kaiser: COMS E6125

REST Representations Response messages may include both representation and resource metadata: information about the resource that is not specific to the supplied representation Control data defines the purpose of a message between components, such as the action being requested or the meaning of a response Also used to parameterize requests and override the default behavior of some connecting elements For example, cache behavior can be modified by control data included in the request or response message 7 February 2012 Kaiser: COMS E6125

REST Representations The current state of the requested resource The desired state for the requested resource The value of some other resource, such as a representation of the input data within a client's query form a representation of some error condition for a response 7 February 2012 Kaiser: COMS E6125

REST Data Formats Known as a media type Data included in a message is processed by the recipient according to the control data of the message and the nature of the media type Some media types are intended for automated processing, some are intended to be rendered for viewing by a user, and some are capable of both 7 February 2012 Kaiser: COMS E6125

REST Data Formats Media type design can impact user-perceived performance Any data that must be received before the recipient can begin rendering the representation adds to latency Placing the most important rendering information up front, such that the initial information can be incrementally rendered while the rest is being received, results in much better user-perceived performance than a data format that must be entirely received before rendering can begin 7 February 2012 Kaiser: COMS E6125

Incremental Rendering Example A Web browser that can incrementally render a large HTML document while it is being received provides significantly better user-perceived performance than one that waits until the entire document is completely received prior to rendering, even though the network performance is the same 7 February 2012 Kaiser: COMS E6125

Applying REST to Web Architecture An architectural model for how the Web should work, such that it could serve as the guiding framework for the Web protocol standards Help identify existing problems, compare alternative solutions, and ensure that protocol extensions would not violate the core constraints that make the Web successful 7 February 2012 Kaiser: COMS E6125

REST Mismatches with URIs Cannot force naming authorities to define their own URIs according to the resource model One abuse is to include information that identifies the current user within URIs Such embedded userids can be used to maintain session state on the server, track user behavior by logging their actions, or carry user preferences across multiple actions By violating REST's constraints, these systems also cause shared caching to become ineffective, reduce server scalability, and result in undesirable effects when a user shares those references with others 7 February 2012 Kaiser: COMS E6125

REST Mismatches with URIs Another conflict occurs when software attempts to treat the Web as a distributed file system Tools exist to "mirror" websites as a means of load balancing and redistributing the content closer to users Treating the contents of a Web server as files may fail because the resource interface does not always match the semantics of a file system, and because both data and metadata are included within, and significant to, the semantics of a representation 7 February 2012 Kaiser: COMS E6125

REST Mismatches with HTTP No consistent mechanism for differentiating between authoritative responses, which are generated by the origin server in response to the current request, and non-authoritative responses that are obtained from an intermediary or cache without accessing the origin server HTTP/1.1 added a mechanism to control cache behavior such that the desire for an authoritative response can be indicated - the 'no-cache' directive on a request message requires any cache to forward the request toward the origin server even if it has a cached copy of what is being requested A more general solution would be to require that responses be marked as non-authoritative whenever an action does not result in contacting the origin server 7 February 2012 Kaiser: COMS E6125

REST Mismatches with HTTP Cookie interaction fails to match REST's model of application state An HTTP cookie is opaque data that can be assigned by the origin server to a user agent by including it within a Set-Cookie response header field, with the intention being that the user agent should include the same cookie on all future requests to that server until it is replaced or expires Cookies typically contain an array of user-specific configuration choices, or a token to be matched against the server's database on future requests 7 February 2012 Kaiser: COMS E6125

REST Mismatches with HTTP A cookie is defined as being attached to any future requests for a given set of URIs, usually an entire site, rather than being associated with the particular application state (the set of currently rendered representations) on the browser Say the browser's history functionality (the "Back" button) is used to backup to a view prior to that reflected by the cookie The next request sent to the same server will contain a cookie that misrepresents the current application context, leading to confusion on both sides 7 February 2012 Kaiser: COMS E6125

REST Mismatches with HTTP The combination of cookies with the Referer [sic] header field makes it possible to track a user as they browse between sites The same functionality (as the desirable aspects of cookies) could have been accomplished via anonymous authentication and true client-side state 7 February 2012 Kaiser: COMS E6125

Contrast with Service-Oriented Architecture (SOA) Basis of web services, but existed as distributed objects before the web (e.g., CORBA, DCOM) Computation proceeds through connections between independent services communicating via remote procedure call (e.g., SOAP over HTTP) Rich collection of methods (the services) with relatively limited parameter passing vs. small number of methods (HTTP) with rich parameter passing (web pages, form data) 7 February 2012 Kaiser: COMS E6125

Summary REST architectural style inherits from client/server: separation of concerns, scalability pipe-and-filter: streams, intermediaries, encapsulation distributed objects: methods, message structure 7 February 2012 Kaiser: COMS E6125

Summary Advantages of representational state transfer: application state controlled by the user agent composed of representations from multiple servers representations can be cached, shared matches hypermedia interaction model of combining information and control 7 February 2012 Kaiser: COMS E6125

Second Assignment: Paper Outline Plan your paper Pretend your reader is another student in this class not the teaching staff It is “ok” to switch topics from your original proposal, but clarify that you’re doing so (and why you’re doing so) 7 February 2012 Kaiser: COMS E6125

Second Assignment: Its All In The Details Each full paper must have a title, abstract (approx. 100 words), introduction, several body sections, conclusion, references list Figure out what will be in the body sections: drill down to subsections (or possibly even subsubsections) Consider the point of view you will portray in your introduction and conclusion Motivate your reading 7 February 2012 Kaiser: COMS E6125

Second Assignment: Logistics Due Tuesday February 14th by 10am Maximum four pages (not including optional figures and required reference list) Submit by posting in Paper Outlines folder on CourseWorks Must be in a format I can read, which means pdf, word, html, plain ascii text (with all figures embedded or viewable in a browser without special “plugins”) 7 February 2012 Kaiser: COMS E6125

Upcoming Assignments Full paper due Tuesday February 28th Project proposal due Tuesday March 6th Presentation proposal also due Tuesday March 6th 7 February 2012 Kaiser: COMS E6125

COMS E6125 Web-enHanced Information Management (WHIM) Prof. Gail Kaiser Spring 2012 7 February 2012 Kaiser: COMS E6125