Of REST and Beans

3,416 views
3,332 views

Published on

Mijn presentatie over REST en Beans in een IBM Domino XPages omgeving, van het XPages & Beer evenement op 12 december 2012.

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

No Downloads
Views
Total views
3,416
On SlideShare
0
From Embeds
0
Number of Embeds
901
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Of REST and Beans

  1. 1. Of REST and Beans Door Thimo Jansen
  2. 2. Introductie* Thimo Jansen* IBM Domino web developer* http://www.thimojansenit.nl
  3. 3. Agenda* REST* JSON* Architectuur* Demo* Code
  4. 4. REST
  5. 5. REST // Definitie Representational State TransferA set of recommended architecturalconstraints in order for a system to bedescribed as RESTfulDoor Roy Fielding, ook HTTP 1.0 en 1.1
  6. 6. REST // Constraints * Client - Server * Stateless * Cacheable * Layered system * Code on demand * Uniform interface
  7. 7. REST // Communicatie Data uitwisseling Client doet weergave Server doet opslag
  8. 8. REST // Communicatie Via HTTP * GET - Ophalen * POST - Aanmaken * PUT - Vervangen * DELETE - Verwijderen Lijkt op CRUD
  9. 9. JSON
  10. 10. JSON // Definitie JavaScript Object Notation* lightweight text-data interchange* taal onafhankelijk* "self-describing", easy to understand
  11. 11. JSON // VoorbeeldObject:{ "firstName":"John", "lastName":"Doe"}
  12. 12. JSON // VoorbeeldArray:[ 100, 200, 300]
  13. 13. JSON // VoorbeeldArray met twee objecten:[ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Hello", "lastName":"World"} ]
  14. 14. JSON // VoorbeeldObject met arrays en objecten:{ "event":"XPages & Beer", "location":"Houten", "speakers" : [ {"firstName":"Tom", "lastName":"Steenbergen"}, {"firstName":"Thimo", "lastName":"Jansen"}, {"firstName":"Erik", "lastName":"van der Arend"} ] } (Syntax: http://www.json.org/, JSON Validator: http://jsonlint.com/)
  15. 15. JSON // Conversie Javascript -> JSONXPages: toJson(myObject);Browser: JSON.stringify(myObject);
  16. 16. JSON // Conversie JSON -> Javascriptvar myJSON = {"firstName":"John", "lastName":"Doe"};XPages: fromJson(myJSON);Browser: JSON.parse(myJSON);
  17. 17. JSON // Conversie Test of iets JSON isXPages: isJson({<some JSON string>});
  18. 18. JSON vs REST JSON != Hypermedia JSON != REST Ja, en?http://norestforjson.blogspot.nl/2012/08/json-is-not-restful.htmlhttp://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
  19. 19. Architectuur
  20. 20. Architectuur // HTML Browser Request Response GET/POST HTML Web server Application logic (SSJS, Beans)
  21. 21. Architectuur // REST Browser AJAX RequestRequest Response Response GET/POST/PUT/GET/POST HTML JSON DELETE Web server Application logic (SSJS, Beans)
  22. 22. Architectuur // REST Browser AJAX Request ResponseRequest Response GET/POST/PUT/ JSONGET/POST HTML DELETE Web server Web server Application logic Application logic
  23. 23. Demo
  24. 24. Code
  25. 25. Contact thimo@jansenit.nl // @thimo http://blog.thimojansenit.nlhttp://linkedin.com/in/thimojansen

×