SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Of REST and Beans
  Door Thimo Jansen
Introductie
* Thimo Jansen
* IBM Domino web developer
* http://www.thimojansenit.nl
Agenda
* REST
* JSON
* Architectuur
* Demo
* Code
REST
REST // Definitie
    Representational State Transfer


A set of recommended architectural
constraints in order for a system to be
described as RESTful


Door Roy Fielding, ook HTTP 1.0 en 1.1
REST // Constraints
 * Client - Server
 * Stateless
 * Cacheable
 * Layered system
 * Code on demand
 * Uniform interface
REST // Communicatie
 Data uitwisseling
 Client doet weergave
 Server doet opslag
REST // Communicatie
  Via HTTP
  * GET - Ophalen
  * POST - Aanmaken
  * PUT - Vervangen
  * DELETE - Verwijderen
  Lijkt op CRUD
JSON
JSON // Definitie
       JavaScript Object Notation


* lightweight text-data interchange
* taal onafhankelijk
* "self-describing", easy to understand
JSON // Voorbeeld
Object:
{
    "firstName":"John",
    "lastName":"Doe"
}
JSON // Voorbeeld
Array:
[
    100, 200, 300
]
JSON // Voorbeeld
Array met twee objecten:
[

        {"firstName":"John", "lastName":"Doe"},

        {"firstName":"Hello", "lastName":"World"}

    ]
JSON // Voorbeeld
Object 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/)
JSON // Conversie
           Javascript -> JSON


XPages:   toJson(myObject);
Browser: JSON.stringify(myObject);
JSON // Conversie
               JSON -> Javascript
var myJSON = '{"firstName":"John", "lastName":"Doe"}';



XPages:     fromJson(myJSON);
Browser: JSON.parse(myJSON);
JSON // Conversie
         Test of iets JSON is


XPages: isJson('{<some JSON string>}');
JSON vs REST
                   JSON != Hypermedia
                   JSON != REST
                   Ja, en?




http://norestforjson.blogspot.nl/2012/08/json-is-not-restful.html
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
Architectuur
Architectuur // HTML

             Browser
  Request              Response
  GET/POST             HTML

          Web server


 Application logic (SSJS, Beans)
Architectuur // REST

                      Browser
                            AJAX Request
Request       Response                       Response
                            GET/POST/PUT/
GET/POST      HTML                           JSON
                            DELETE

                    Web server


           Application logic (SSJS, Beans)
Architectuur // REST

                     Browser
                         AJAX Request       Response
Request     Response
                         GET/POST/PUT/      JSON
GET/POST    HTML
                         DELETE

   Web server                    Web server


 Application logic             Application logic
Demo
Code
Contact
   thimo@jansenit.nl // @thimo
   http://blog.thimojansenit.nl
http://linkedin.com/in/thimojansen

Más contenido relacionado

Similar a Of REST and Beans

Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2kriszyp
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webkriszyp
 
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...Thomas Witt
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problemstitanlambda
 
RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databaseskriszyp
 
Android App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAndroid App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAnuchit Chalothorn
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5Eyal Vardi
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
01. http basics v27
01. http basics v2701. http basics v27
01. http basics v27Eoin Keary
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasyJBug Italy
 

Similar a Of REST and Beans (20)

Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the web
 
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problems
 
RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databases
 
Android App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAndroid App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web Services
 
08 ajax
08 ajax08 ajax
08 ajax
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
01. http basics v27
01. http basics v2701. http basics v27
01. http basics v27
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 
REST
RESTREST
REST
 
JSON
JSONJSON
JSON
 
Advanced I/O in browser
Advanced I/O in browserAdvanced I/O in browser
Advanced I/O in browser
 
Android and REST
Android and RESTAndroid and REST
Android and REST
 
Intro to Sail.js
Intro to Sail.jsIntro to Sail.js
Intro to Sail.js
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 

Más de Thimo Jansen

AuditCase & XPages
AuditCase & XPagesAuditCase & XPages
AuditCase & XPagesThimo Jansen
 
XPages & Beer - Behind the scenes
XPages & Beer - Behind the scenesXPages & Beer - Behind the scenes
XPages & Beer - Behind the scenesThimo Jansen
 
XPages * XDocReport = X3
XPages * XDocReport = X3XPages * XDocReport = X3
XPages * XDocReport = X3Thimo Jansen
 
Een XPages implementatie van het Ogone betaalplatform
Een XPages implementatie van het Ogone betaalplatformEen XPages implementatie van het Ogone betaalplatform
Een XPages implementatie van het Ogone betaalplatformThimo Jansen
 
Engage - XPages & Beer
Engage - XPages & BeerEngage - XPages & Beer
Engage - XPages & BeerThimo Jansen
 

Más de Thimo Jansen (7)

TeamPlan brochure
TeamPlan brochureTeamPlan brochure
TeamPlan brochure
 
AuditCase & XPages
AuditCase & XPagesAuditCase & XPages
AuditCase & XPages
 
XPages & Beer - Behind the scenes
XPages & Beer - Behind the scenesXPages & Beer - Behind the scenes
XPages & Beer - Behind the scenes
 
XPages * XDocReport = X3
XPages * XDocReport = X3XPages * XDocReport = X3
XPages * XDocReport = X3
 
Een XPages implementatie van het Ogone betaalplatform
Een XPages implementatie van het Ogone betaalplatformEen XPages implementatie van het Ogone betaalplatform
Een XPages implementatie van het Ogone betaalplatform
 
Engage - XPages & Beer
Engage - XPages & BeerEngage - XPages & Beer
Engage - XPages & Beer
 
xe:objectData
xe:objectDataxe:objectData
xe:objectData
 

Último

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Of REST and Beans

  • 1. Of REST and Beans Door Thimo Jansen
  • 2. Introductie * Thimo Jansen * IBM Domino web developer * http://www.thimojansenit.nl
  • 3. Agenda * REST * JSON * Architectuur * Demo * Code
  • 5. REST // Definitie Representational State Transfer A set of recommended architectural constraints in order for a system to be described as RESTful Door Roy Fielding, ook HTTP 1.0 en 1.1
  • 6. REST // Constraints * Client - Server * Stateless * Cacheable * Layered system * Code on demand * Uniform interface
  • 7. REST // Communicatie Data uitwisseling Client doet weergave Server doet opslag
  • 8. REST // Communicatie Via HTTP * GET - Ophalen * POST - Aanmaken * PUT - Vervangen * DELETE - Verwijderen Lijkt op CRUD
  • 10. JSON // Definitie JavaScript Object Notation * lightweight text-data interchange * taal onafhankelijk * "self-describing", easy to understand
  • 11. JSON // Voorbeeld Object: { "firstName":"John", "lastName":"Doe" }
  • 12. JSON // Voorbeeld Array: [ 100, 200, 300 ]
  • 13. JSON // Voorbeeld Array met twee objecten: [ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Hello", "lastName":"World"} ]
  • 14. JSON // Voorbeeld Object 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. JSON // Conversie Javascript -> JSON XPages: toJson(myObject); Browser: JSON.stringify(myObject);
  • 16. JSON // Conversie JSON -> Javascript var myJSON = '{"firstName":"John", "lastName":"Doe"}'; XPages: fromJson(myJSON); Browser: JSON.parse(myJSON);
  • 17. JSON // Conversie Test of iets JSON is XPages: isJson('{<some JSON string>}');
  • 18. JSON vs REST JSON != Hypermedia JSON != REST Ja, en? http://norestforjson.blogspot.nl/2012/08/json-is-not-restful.html http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
  • 20. Architectuur // HTML Browser Request Response GET/POST HTML Web server Application logic (SSJS, Beans)
  • 21. Architectuur // REST Browser AJAX Request Request Response Response GET/POST/PUT/ GET/POST HTML JSON DELETE Web server Application logic (SSJS, Beans)
  • 22. Architectuur // REST Browser AJAX Request Response Request Response GET/POST/PUT/ JSON GET/POST HTML DELETE Web server Web server Application logic Application logic
  • 23. Demo
  • 24. Code
  • 25. Contact thimo@jansenit.nl // @thimo http://blog.thimojansenit.nl http://linkedin.com/in/thimojansen