How does the Web work?

710 views
647 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
710
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How does the Web work?

  1. 1. How does the web work? aka HTTP 101 by Guilherme Cavalcanti @guiocavalcanti
  2. 2. Schedule1. Some Web Principles2. REST3. HTTP Verbs Idempotency Side effects GET and POST Vs. PUT and DELETE4. Rails5. AJAX vs. Accessibility
  3. 3. Some Web Principles Universality Any resource anywhere can be given a URI Any resource of significance should be given a URI. Resources are documents As well as concepts and abstract ideias (Semantic Web) Global Scope It doesnt matter to whom or where you specify that URI, it will have the same meaning.
  4. 4. REST Architectural style coined by Roy Fielding (phd dissertation)5 State transference At any particular time, a client can either be in transition between application states or "at rest". A client in a rest state is able to interact with its user, but creates no load and consumes no per-client storage on the servers or on the network4 The HTTP portocols uses the rest style
  5. 5. HTTP Verbs Side effect change or not the state of the world Idempotency the side-effects of N > 0 identical requests is the same as for a single request
  6. 6. HTTP Verbs Idempotent Cacheable Side effects GET x x POST x PUT x x DELETE x
  7. 7. HTTP: RESTful services vs lack of verbs PUT Put ssomething at some place Updates something PUT http://redu.com.br/spaces/my-space Content: My new Space POST The server decides which action gonna be taken POST http://redu.com.br/spaces/filter Content: name=my;audience=[higher-edu,sat] DELETE Deletes some resource DELETE http://redu.com.br/spaces/my-space
  8. 8. HTTP: RESTful services vs lack of verbs Doesnt work on6 < HTML 4 < XHTML 1.0 It works on XMLHttpRequests (aka AJAX)3
  9. 9. HTTP: RESTful services vs lack of verbs POST acting as PUT POST http://redu.com.br/spaces Content: name=My Space;path=my-space POST acting as PUT when updating POST http://redu.com.br/spaces/my-space Content: _method=PUT POST acting as DELETE POST http://redu.com.br/spaces/my-space Content: _method=DELETE
  10. 10. How Rails deals with it?Edit:
  11. 11. References1. Why put and delete?2. HTTP RFC3. Verbs support4. REST5. Roys dissertation6. Useful question at Stackoverflow

×