Web Architecture

Ezra Cooper

University of Edinburgh

The Idea

Sources—Whatchu talkin' bout, Willis?

What's a resource?

What's a resource?

What's a resource?

Examples of Resources

Examples of Resources

http://flickr.com/photos/tags/beltane

Examples of Resources

http://labs.google.com/ridefinder?z=4&near=Washington%2C%20DC&src=1

Examples of Resources

<html xmlns="http://www.w3.org/1999/xhtml">

URIs, URNs, URLs

URIs come in two kinds:

Inside a URI

http:// ed.ac.uk /lfcs/lab-lunch ?month=May #web-arch
Scheme Authority Path Query Fragment

Two important properties of a URI:

What can I do with a resource?

How resources behave

A resource is like a reference cell.

Here's a picture of the resource "Ezra's favorite band." It changes over time.

URIs, Resources, Representations

One or more URIs can identify a resource; one resource can have zero or more representations.

Why URN?

A URN identifies a resource with no representations. Why offer less than one?

Example: City of Edinburgh has no web servers but wants to allow 3rd parties to refer to individual streetlamps.

urn:edinburgh.uk:streetlamp,1456

Lesson:

Making up URIs does not require you to provide services. URIs are for identification.

Multiple representations

Why offer more than one representation?

Rep'n can depend on viewer

http://flickr.com/photos/good_day/59673447

What defines a resource?

A resource is defined by whatever concept its owner wants to use.

Relative resources considered harmful

Consider a resource whose definition is relative to the person who's viewing it, and one that's the same for everyone:

The former definition breaks when I send the link to my mate.

A resource should be defined by a durable, viewer-independent concept.
Private information should be protected by other means than obscure naming.

How resources behave

Resources can hold the same contents, yet be distinct (like reference cells).

Distinctness is determined by the resource owner, but generally follows the URI.

Aliasing of resources

More than one URI can point to the same resource.

This should be avoided, but is sometimes necessary (backward compatibility).

Latest version & dated versions

"The current version" of a paper is a resource of interest, as is "the version published in such-and-such journal."

"The current value of X" and "The value of X at time T" are (usually) distinct resources. Assign distinct URIs.
Use this technique for documents that change.

Intermediaries: components that care

Any number of intermediaries can lie between client and server.

Caches will compare URIs; this is one reason why aliasing is bad.

Besides these discrete network components, there can be other software systems that want to know the identity of a resource.

External services: annotation

Verbs: HTTP methods

Why use the right method?

HTTP methods show what you're doing so intermediaries know what you're doing

APIs: beyond browsing

APIs: beyond browsing

Web APIs: Extending the web

Two principles an API could follow:

Comparing design principles (SOAP)

Comparing design principles (REST)

What if you need more?

That's all