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 2
kriszyp
 
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
kriszyp
 
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
titanlambda
 
RESTful JSON web databases
RESTful JSON web databasesRESTful JSON web databases
RESTful JSON web databases
kriszyp
 
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
Anuchit 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.5
Eyal Vardi
 
RESTful services
RESTful servicesRESTful services
RESTful services
gouthamrv
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
b_kathir
 

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

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

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+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...
 
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
 
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...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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