Web Services, Web Apps, and REST - GOTO...

102
Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen 2011 1 Friday, May 13, 2011

Transcript of Web Services, Web Apps, and REST - GOTO...

Page 1: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Web Services,Web Apps, and REST

Stefan Tilkov, @stilkov | GOTO Copenhagen 2011

1Friday, May 13, 2011

Page 2: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

(Personal)History

2Friday, May 13, 2011

Page 3: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Sockets

3Friday, May 13, 2011

Page 4: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

RPC

4Friday, May 13, 2011

Page 5: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

DCE

5Friday, May 13, 2011

Page 6: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

CORBA

6Friday, May 13, 2011

Page 7: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

RMI

7Friday, May 13, 2011

Page 8: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

MOM

8Friday, May 13, 2011

Page 9: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

WS-*

9Friday, May 13, 2011

Page 10: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

10Friday, May 13, 2011

Page 11: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

“Add the missing parts to the Web”

11Friday, May 13, 2011

Page 12: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

REST

12Friday, May 13, 2011

Page 13: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

RESTful HTTP

13Friday, May 13, 2011

Page 14: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

URIs Identi!es Resources

http://example.com/orders?year=2008

http://example.com/customers/1234

http://example.com/orders/2007/10/776654

http://example.com/products/4554

http://example.com/processes/sal-increase-234

14Friday, May 13, 2011

Page 15: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Resources are Linked

15Friday, May 13, 2011

Page 16: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Representations in di!erent Formats

XML

HTMLXHTML

JSONYAML

Plain Text

PDF

Binary

16Friday, May 13, 2011

Page 17: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Customer

Order

Delivery Product

CustomerList

ProductCatalog

Rating

«interface»Resource

17Friday, May 13, 2011

Page 18: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

GETPUT

POSTDELETE

«interface»Resource

18Friday, May 13, 2011

Page 19: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://www.flickr.com/photos/stygiangloom/230412544/

Tunneling

19Friday, May 13, 2011

Page 20: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

(a.k.a. The SOAP Way)

20Friday, May 13, 2011

Page 21: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

POST http://example.com/CustomerMgmt<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <deleteCustomer xmlns="http://example.com/ns1"> <customerId>13</customerId> </ns:deleteCustomer> </soap:Body></soap:Envelope>

Method ID Endpoint

21Friday, May 13, 2011

Page 22: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

22Friday, May 13, 2011

Page 23: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

23Friday, May 13, 2011

Page 24: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

24Friday, May 13, 2011

Page 25: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

“Thank you for nothing.”

Enterprise Web

"Here are the missing parts of the Web!”

25Friday, May 13, 2011

Page 26: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

The Human Web

26Friday, May 13, 2011

Page 27: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

27Friday, May 13, 2011

Page 28: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Resources and URIs

Pretty URLs

Bookmarks

Collaboration

Caching

Links/Hypermedia

Noti"cation via Feeds

28Friday, May 13, 2011

Page 29: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Web Sitesvs.

Web Applications

29Friday, May 13, 2011

Page 30: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Using the Webvs.

Abusing the Web

30Friday, May 13, 2011

Page 31: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

There should be no applications

31Friday, May 13, 2011

Page 32: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Customer

Order Delivery

ProductCustomerList

ProductCatalog

CustomerView

OrderEntryForm ProductMaintenanceForm

32Friday, May 13, 2011

Page 33: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Customer

Order

Delivery Product

CustomerList

ProductCatalog

Rating

«interface»Resource

CustomerViewOrderEntryForm

ProductMaintenanceForm

33Friday, May 13, 2011

Page 34: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

What’s in an app?

34Friday, May 13, 2011

Page 35: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

Server AClient A

Server BClient B

35Friday, May 13, 2011

Page 36: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

Server A

Server B

Client Portal

36Friday, May 13, 2011

Page 37: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

37Friday, May 13, 2011

Page 38: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

Server A

Server B

Resource 1

Resource 2

Resource n

Representation 1

Representation 2

Representation n

......

38Friday, May 13, 2011

Page 39: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Web Frameworks of 2001

Hide HTTP, URIs, HTML

Maintain Desktop-app state on server

Tunnel Stateful Apps through the Web

39Friday, May 13, 2011

Page 40: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH

JSF Life Cycle

40Friday, May 13, 2011

Page 41: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH41Friday, May 13, 2011

Page 42: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH

How much HTTP would you like with that?

42Friday, May 13, 2011

Page 43: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH

Component-based

JSF

ASP.NET

Wicket

Tapestry

GWT

43Friday, May 13, 2011

Page 44: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH

Request/Response-oriented

Struts

PlayGrails

Rails

ASP.NET MVC

PHPDjango

Spring MVC

44Friday, May 13, 2011

Page 45: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

© 2011 innoQ Deutschland GmbH

Linkable and “pretty” URIs

GET/POST di!erentiation

Support for caching

Full control over HTML

1 Resource, n Views

Request/Response Frameworks

45Friday, May 13, 2011

Page 46: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

“But what about statefulWeb applications?”

46Friday, May 13, 2011

Page 47: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Server

Client 1

Client 2State Client 1

State Client 2

Server State

R1R2

Rn

Representation

R1

R2

Turn session state …

47Friday, May 13, 2011

Page 48: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Server

Client 1

C1 C1

Client 2

C2

State Client 1

State Client 2

Server State

Representation

R1 R2

RnC2

C2

C2

C1C1

R2

R1

… into client or resource state

48Friday, May 13, 2011

Page 49: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser Server

HTML Page

Label

Label

Label

Label

Label

Label

Label

Label

Submit

49Friday, May 13, 2011

Page 50: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser Server

Label

Label

Label

Next

Label

Label

Label

Next

Label

Label

Finish

SessionState

50Friday, May 13, 2011

Page 51: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

Server

Label

Label

Label

Next

Label

Label

Label

Next

Label

Label

Finish

HTML Page

Label

Label

Label

Label

Label

Label

Label

Label

Submit

Client State

51Friday, May 13, 2011

Page 52: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

JavaScript

52Friday, May 13, 2011

Page 53: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

JavaScript Perception

“Toy language”

Incompatible

Inherent design problems

Low Performance

53Friday, May 13, 2011

Page 54: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://commons.wikimedia.org/wiki/File:Audi_S5_V8_FSI_engine.jpg

54Friday, May 13, 2011

Page 55: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

55Friday, May 13, 2011

Page 56: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://commons.wikimedia.org/wiki/File:Ateles_paniscus_-Brazil-8.jpg

56Friday, May 13, 2011

Page 57: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

57Friday, May 13, 2011

Page 58: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

The JavaScript Arms Race

58Friday, May 13, 2011

Page 59: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

59Friday, May 13, 2011

Page 60: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

60Friday, May 13, 2011

Page 61: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://oreilly.com/catalog/9780596517748

61Friday, May 13, 2011

Page 62: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

62Friday, May 13, 2011

Page 63: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

JavaScript Today

Popular & widely used

O"en mandatory

Fast

Compatible

Best practices

63Friday, May 13, 2011

Page 64: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

5.1.7 Code-On-DemandThe final addition to our constraint set for REST comes from the code-on-demand style of Section 3.5.3 (Figure 5-8). REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts. This simplifies clients by reducing the number of features required to be pre-implemented. Allowing features to be downloaded after deployment improves system extensibility. However, it also reduces visibility, and thus is only an optional constraint within REST.

http://www.ics.uci.edu/~!elding/pubs/dissertation/rest_arch_style.htm#sec_5_1_7

64Friday, May 13, 2011

Page 65: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Unobtrusive JavaScript

65Friday, May 13, 2011

Page 66: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

<a href="javascript:function1();">Some Link</a>

66Friday, May 13, 2011

Page 67: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

<a href="#" onclick="function1();">Some Link</a>

67Friday, May 13, 2011

Page 68: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

<a href="/some-resource" onclick="function1(this.href);">Some Link</a>

68Friday, May 13, 2011

Page 69: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

<a href="/some-resource" class="whatever">Some Link</a>

69Friday, May 13, 2011

Page 70: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

JavaScript

CSSHTML

Content

Behavior

Layout

70Friday, May 13, 2011

Page 71: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Caching

71Friday, May 13, 2011

Page 72: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

“I do think the REST-afarians are missing an opportunity by not driving home the secret sauce that is HTTP GET. […] GET is one of the most optimized pieces of distributed systems plumbing in the world.

Don Box, Co-inventor of SOAP

72Friday, May 13, 2011

Page 73: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Cacheable Elements

73Friday, May 13, 2011

Page 74: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Obvious

Static text

Images

CSS

JavaScript

Non-obvious

Menus

Hierarchies

Processing Results

Immutable stu#

74Friday, May 13, 2011

Page 75: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

The problem:Personalized dynamic

elements

75Friday, May 13, 2011

Page 76: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

76Friday, May 13, 2011

Page 77: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Logout

77Friday, May 13, 2011

Page 78: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Login

78Friday, May 13, 2011

Page 79: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Edge Side Includes (ESI)

79Friday, May 13, 2011

Page 80: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

<esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html" onerror="continue"/>

<esi:include src="http://example.com/search?query=$(QUERY_STRING{query})"/>

80Friday, May 13, 2011

Page 81: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

HTML Page

BackendStatic Cache

Dynamic Dynamic

Static

81Friday, May 13, 2011

Page 82: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

HTML Page

BackendStatic Cache

Dynamic Dynamic

Static

82Friday, May 13, 2011

Page 83: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Ajax

83Friday, May 13, 2011

Page 84: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

HTML Page

BackendStatic Cache

Dynamic Dynamic

Static

84Friday, May 13, 2011

Page 85: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Browser

HTML Page

BackendStatic Cache

Dynamic

Dynamic

Static

85Friday, May 13, 2011

Page 86: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

#!

http://www.jenitennison.com/blog/node/154

86Friday, May 13, 2011

Page 87: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

#

87Friday, May 13, 2011

Page 88: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

#“When a URI reference is used to perform a retrieval action on the identi!ed resource, the optional fragment identi!er, separated from the URI by a crosshatch (“#”) character, consists of additional reference information to be interpreted by the user agent a!er the retrieval action has been successfully completed. As such, it is not part of a URI, but is o"en used in conjunction with a URI.”

URI Speci!cation, August 1998

88Friday, May 13, 2011

Page 89: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

#The fragment identi!er component of a URI allows indirect identi"cation of a secondary resource by reference to a primary resource and additional identifying information. The identi!ed secondary resource may be some portion or subset of the primary resource, some view on representations of the primary resource, or some other resource de!ned or described by those representations.

URI Speci!cation, January 2005

89Friday, May 13, 2011

Page 90: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

#!

90Friday, May 13, 2011

Page 91: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://example.com/someapp#!state=234

http://example.com/someapp?_escaped_fragment=234

91Friday, May 13, 2011

Page 92: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

http://googlewebmastercentral.blogspot.com/2009/10/proposal-for-making-ajax-crawlable.html

92Friday, May 13, 2011

Page 93: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Complex

Inaccessible

Brittle

Invisible to search engines (#)

# and #! Downsides

93Friday, May 13, 2011

Page 94: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

HTML 5

pushState()replaceState()

94Friday, May 13, 2011

Page 95: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Summary

95Friday, May 13, 2011

Page 96: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Embrace the Web,Don't !ght it

96Friday, May 13, 2011

Page 97: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Web UIs !rst,Client apps second

97Friday, May 13, 2011

Page 98: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Don’t repeat server mistakes on the client

98Friday, May 13, 2011

Page 99: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

If you can't link to it, does it exist?

99Friday, May 13, 2011

Page 100: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

If you can't build real Web apps with it, is it worth your

time?

100Friday, May 13, 2011

Page 101: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Thank you!

Q&A

101Friday, May 13, 2011

Page 102: Web Services, Web Apps, and REST - GOTO Conferencegotocon.com/dl/goto-cph-2011/slides/StefanTilkov... · Web Services, Web Apps, and REST Stefan Tilkov, @stilkov | GOTO Copenhagen

Stefan [email protected]://www.innoq.com/blog/st/@stilkovPhone: +49 170 471 2625

innoQ Deutschland GmbH innoQ Schweiz GmbH

www.innoq.com [email protected]

Halskestr. 17D-40880 RatingenPhone: +49 21 02 77 172-100

Gewerbestr. 11CH-6630 ChamPhone: +41 41 02 743 01 11

102Friday, May 13, 2011