SlideShare a Scribd company logo
1 of 48
Download to read offline
REST and AJAX
  reconciled
Lars Trieloff at AJAX World East 2008
What is REST?
What is REST?
• Buzzword
What is REST?
• Buzzword
• Alternative to SOAP
What is REST?
• Buzzword
• Alternative to SOAP
• Representational State Transfer
What is REST?
• Buzzword
• Alternative to SOAP
• Representational State Transfer
• Architecture of the World Wide Web
What is REST?
• Buzzword
• Alternative to SOAP
• Representational State Transfer
• Architecture of the World Wide Web
• Architecture for Scalable Network Applications
How do we start?
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
Things are Resources

                        Resource




Resources can be items of information (a blog entry) or or
 informational descriptions of real things (a blog author)
Resources have URIs

                         Resource



                            URI

Uniform Resource Identifier are unique ids for resources, just
   like ISBN for a book or a driver’s license for a person
Resources have Representations


    Representation     Resource       Representation



                          URI

 Representations can have different formats (HTML, XML,
      JSON) or show different aspects of a resource.
Representations have URLs
      URL                                   URL


 Representation       Resource         Representation



                         URI

 Uniform Resource Locators describe how to get to a
  representation of a resource, they include protocol,
        hostname, path and extra information
Clients interact via Verbs
GET        URL         POST              PUT       URL          DELETE




      Representation          Resource         Representation



                                URI

      Uniform Resource Locators describe how to get to a
       representation of a resource, they include protocol,
             hostname, path and extra information
GET is for reading
            GET




       Representation                Representation



         Resource                      Resource

          Before                          After
GET is a “safe” method. There are no side-effects, and the
          requested resource stays unmodified.
PUT is for replacing
         PUT




    Representation               Representation



      Resource                     Resource

       Before                        After
PUT is a “idempotent” method. Issuing the same PUT
   request multiple times yields the same result.
DELETE is for deleting
          DELETE




     Representation



       Resource

         Before                        After
DELETE is also “idempotent”. Deleting a resource twice
    yields the same result - the resource is gone.
POST is for action
            POST




       Representation           Representation     Representation



          Resource                Resource           Resource

           Before                          After
POST is neither safe nor idempotent. It is used for updating,
             creating and executing resources.
So what?
 • There are unlimited resources
 • Every resource can be addressed
 • There are only four verbs
 • Resources have an uniform interface
This makes it easy to write clients for existing REST
applications and makes it easy to expose a RESTful
             interface to an application.
How do we go on?
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
What are REST Clients

• Libwww         • Microsoft Internet
                   Explorer
• Apache Commons
  HTTPClient     • Mozilla Firefox
• Python httplib • Apple Safari
• Ruby Net::HTTP • Opera
HTTP Client Libraries

  + Full HTTP Support

  + Desktop Applications

  +Server-side mashups
  - Not in the web browser
Web Browsers as HTTP Clients

      + No client needed

      +Everywhere installed
      - Weak HTTP Support
      - Web Forms 1.0
      - Browser Bugs
Web Forms 1.0
<form
    action=quot;/blogquot;
    method=quot;POSTquot;                               >
    enctype=quot;application/x-www-form-urlencodedquot;

                             label>
  <label for=quot;titlequot;>Title</
                                  >
  <input type=quot;textquot; name=quot;titlequot;
  <label for=quot;textquot;>Entry</label>
  <textarea name=quot;textquot;>
  </textarea>
  <input type=quot;submitquot;>
</form>
Web Forms 1.0
           w do I e
   But ho chang
      <foally
       icrmction=g/bt ogquot;
dynam ioan (tarquot; e l
 the act me) hofdthPe STquot;ication/x-www-form-urlencodedquot;>
              t   =quot; O
         rcee coype=quot;appl
   resou n t?
        foabm for=quot;titlequot;>Title</label>
         <l
            r el
                                         >
         <input type=quot;textquot; name=quot;titlequot;
         <label for=quot;textquot;>Entry</label>
         <textarea name=quot;textquot;>
         </textarea>
         <input type=quot;submitquot;>
       </form>
Web Forms 1.0
                                         Why
          w do I e
   But ho chang                        and P do only
      <foally                         work   OST m GET
       icrmction=g/bt ogquot;
dynam ioan (tarquot; e l                         and P ethods
                                     DELET
 the act me) hofdthPe STquot;ication/x-www-formEuarencoUeda>nd
             t    =quot; O
               oype=quot;appl                             Tquot;
     sourcee ct                                  ignore
                                           - rle    d
   re       n
                                                         d?
        fo rm? quot;titlequot;>Title</label>
         <label for=
                                         >
         <input type=quot;textquot; name=quot;titlequot;
         <label for=quot;textquot;>Entry</label>
         <textarea name=quot;textquot;>
         </textarea>
         <input type=quot;submitquot;>
       </form>
Web Forms 1.0
                                         Why
          w do I e
   But ho chang                        and P do only
      <foally                         work   OST m GET
       icrmction=g/bt ogquot;
dynam ioan (tarquot; e l                         and P ethods
                                     DELET
 the act me) hofdthPe STquot;ication/x-www-formEuarencoUeda>nd
             t    =quot; O
               oype=quot;appl                             Tquot;
     sourcee ct                                  ignore
                                           - rle    d
   re       n
                                                         d?
        fo rm? quot;titlequot;>Title</label>
         <label for=
                                         >
                type=quot;textquot; name=quot;titlequot;
         <input
         <label
                   How do I specify a
                for=quot;textquot;>Entry</label>
                       different
         <textarea name=quot;textquot;>
         </textarea> encoding, for
         <input type=quot;submitquot;>
       </form>     example XML or
                        JSON?
Solutions:
     • Changing the action dynamically: URI
       Templates

     • Other Methods than POST and GET: Web
       Forms 2.0

     • More advanced encodings: Web Forms 2.0
http://bitworking.org/projects/URI-Templates/
http://www.whatwg.org/specs/web-forms/current-work/
Solution for now:
making browsers better HTTP clients using




AJAX
Where are we now?
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
With AJAX we can
• get data-only (JSON) representations of
  web pages in the background

• Overload Web Forms 1.0 behavior, and
  make them 2.0

• issue data-only (JSON) HTTP requests to
  these very resources
Getting alternate
        Representations
<head>
                            tle>
  <title>REST and AJAX</ti                       =quot;text/jsonquot;>
  <link rel=quot;alterna  tequot; href=quot;this.jsonquot; type
                             criptquot;>
  <script type=quot;text/javas
  function initRest() {
                                          TagName(quot;linkquot;);
     var links  = document.getElementsBy
                                                ntriesquot;);
     var entries = do cument.getElementById(quot;e
     for (link in links) {
                                     natequot;) {
       if  (links[link].rel==quot;alter
                                                     list of entries
          //pull data and  populate entries with a
       }
     }
   }
   </script>
 </head>
                           quot;>
 <body onload=quot;initRest()
   <ul id=quot;entriesquot;>
   </ul>
 </body>
Overloading Forms
                      quot;
<form a ction=quot;/blog
  method=quot;PUTquot;
  enctype=  quot;text/jsonquot;              urn false;quot;>
                    orm(this);ret
  ons ubmit=quot;RESTF            Title</title>
       <label   for=quot;titlequot;>
                                it le</label>
       <label f  or=quot;titlequot;>T
                              n ame=quot;titlequot;>
       <input   type=quot;textquot;                 >
                           > Entry</label
        <labe l for=quot;textquot;
        <textarea   name=quot;textquot;>
        </textarea>
         <input typ e=quot;submitquot;>
      </form>
Data-only requests
 function RESTForm(fo
                      rm) {
   var json = quot;{quot; +
     quot;title: quot; + form.tit
                          le.value +quot;, quot; +
     quot;text: quot; + form.text
                          .value +
   quot;}quot;;
   var xmlhttp = (windo
                        w.XMLHttpRequest) ?
     new XMLHttpRequest()
                           :
     ActiveXObject(quot;Micro
                          soft.XMLHTTPquot;);
  xmlhttp.open(form.me
                       thod, form.action);
  xmlhttp.send(json);
}
Planning RESTful AJAX
       applications
1. Define the domain model
2. Define Resources, Resource Types and
   URIs
3. Define Representations for Resources
4. Define POST behavior
Watch out!
 common pitfalls and how to cope with them

• Problem: Some browsers do not support
  PUT or DELETE requests, even as XHR

• Solution: Wrap your PUT or DELETE
  Request in a POST request and add the X-
  HTTP-Method-Override Header
Watch out!
 common pitfalls and how to cope with them

• Problem: Some browsers do not handle
  301 or 302 response codes for redirects
  properly

• Solution: Define a format for redirection
  messages that wraps headers such as
  Location and Status codes in JSON
What is next?
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
Framework Checklist
        frameworks can help getting the job done

•   Resource-based approach?
    •    having something like /action/view/1 is a warning sign

•   Acknowledges existence of Representations?
    •    you need multiple representations

•   Solid engineering, community, support?
    •    without, you can do it on your own
Framework Examples
frameworks that can help getting the job done

•   Apache Cocoon
    •   based on XML pipelines, URL patterns, selectors

•   RESTlet
    •   Like Servlets for REST. Good for existing models

•   Apache Sling
    •   based on JCR, a database for resources, with server-
        side scripting support
How do we go on?
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
Sling with µjax
• Exposes the complete JCR repository
  (Resource Database) as JSON tree

• API for reading, creating, writing, deleting
  and moving Resources

• Stand-alone Javascript library, plays nicely
  with your framework

• Extra: Dojo Toolkit Integration
µjax Core Principles
 I   browser & ujax.js
     reading: json & resource GET’s
     writing: form-POST & GET
                         s      s
                                                 J2EE Web
                                                  Server
                                          3
                                      2
Browser                     I
                                              2 UjaxServlet.java
                                                translating requests
                                                 to JCR calls
                                              3 JCR Compliant
                                                 Content Repository
µjax Core Principles
 I   browser & ujax.js
     reading: json & resource GET’s
     writing: form-POST & GET
                         s      s
                                                         J2EE Web
                                                          Server
                                                  3
                                              2
Browser                     I
                       very simple js A               2 UjaxServlet.java
                                                        translating requests
                      read content, FoPI to              to JCR calls
                                       r
                        to write contenms
                                        t             3 JCR Compliant
                                                         Content Repository
µjax Core Principles
 I   browser & ujax.js
     reading: json & resource GET’s
     writing: form-POST & GET
                         s      s
                                                             J2EE Web
                                                              Server
                                                  3
                                              2       handles all the h
                                                       particularly se
                                                                       eavy lifting,
                                                                        curity
Browser                     I                                                     16 t
                                                                                      ons



                       very simple js A                 2 UjaxServlet.java
                                                          translating requests
                      read content, FoPI to                   to JCR calls
                                       r
                        to write contenms
                                        t              3 JCR Compliant
                                                              Content Repository
Never leave without
                        screenshots




resource or
http://l    iented urls                                      integration
                                                 dojo widget
        ocalhost
                :7402/my
                        data/ent
                                ries.lis
                                        t.html
Never leave without
   screenshots




          dojo widget integration
What we heard today
• Introduction
• Core Concepts
• REST Clients
• AJAX REST Clients
• REST Frameworks
• REST Frameworks for AJAX
Thank you very much
            lars.trieloff@day.com




 For more information, see my weblog at
 http://weblogs.goshaky.com/weblog/lars

More Related Content

What's hot

Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xmlmussawir20
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5Vance Lucas
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3Jeremy Coates
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Gheyath M. Othman
 
Like a can opener for your data silo: simple access through AtomPub and Jangle
Like a can opener for your data silo: simple access through AtomPub and JangleLike a can opener for your data silo: simple access through AtomPub and Jangle
Like a can opener for your data silo: simple access through AtomPub and Jangleeby
 
Hypermedia In Practice - FamilySearch Developers Conference 2014
Hypermedia In Practice - FamilySearch Developers Conference 2014Hypermedia In Practice - FamilySearch Developers Conference 2014
Hypermedia In Practice - FamilySearch Developers Conference 2014Ryan Heaton
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamudAsfak Mahamud
 
05 File Handling Upload Mysql
05 File Handling Upload Mysql05 File Handling Upload Mysql
05 File Handling Upload MysqlGeshan Manandhar
 
The Ring programming language version 1.4 book - Part 13 of 30
The Ring programming language version 1.4 book - Part 13 of 30The Ring programming language version 1.4 book - Part 13 of 30
The Ring programming language version 1.4 book - Part 13 of 30Mahmoud Samir Fayed
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07Hassen Poreya
 
XPages Extension Library - Create an app in 1 hour (almost)
XPages Extension Library - Create an app in 1 hour (almost)XPages Extension Library - Create an app in 1 hour (almost)
XPages Extension Library - Create an app in 1 hour (almost)Per Henrik Lausten
 
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5Salvatore Iaconesi
 

What's hot (19)

Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3
 
Lab final
Lab finalLab final
Lab final
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 
Like a can opener for your data silo: simple access through AtomPub and Jangle
Like a can opener for your data silo: simple access through AtomPub and JangleLike a can opener for your data silo: simple access through AtomPub and Jangle
Like a can opener for your data silo: simple access through AtomPub and Jangle
 
Hypermedia In Practice - FamilySearch Developers Conference 2014
Hypermedia In Practice - FamilySearch Developers Conference 2014Hypermedia In Practice - FamilySearch Developers Conference 2014
Hypermedia In Practice - FamilySearch Developers Conference 2014
 
Isomorphic react in real life
Isomorphic react in real lifeIsomorphic react in real life
Isomorphic react in real life
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
05 File Handling Upload Mysql
05 File Handling Upload Mysql05 File Handling Upload Mysql
05 File Handling Upload Mysql
 
Xml p2 Lecture Notes
Xml p2 Lecture NotesXml p2 Lecture Notes
Xml p2 Lecture Notes
 
L16 Object Relational Mapping and NoSQL
L16 Object Relational Mapping and NoSQLL16 Object Relational Mapping and NoSQL
L16 Object Relational Mapping and NoSQL
 
The Ring programming language version 1.4 book - Part 13 of 30
The Ring programming language version 1.4 book - Part 13 of 30The Ring programming language version 1.4 book - Part 13 of 30
The Ring programming language version 1.4 book - Part 13 of 30
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
 
PHP
PHP PHP
PHP
 
Xml 2
Xml  2 Xml  2
Xml 2
 
Yql && Raphaël
Yql && RaphaëlYql && Raphaël
Yql && Raphaël
 
XPages Extension Library - Create an app in 1 hour (almost)
XPages Extension Library - Create an app in 1 hour (almost)XPages Extension Library - Create an app in 1 hour (almost)
XPages Extension Library - Create an app in 1 hour (almost)
 
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
 

Similar to REST and AJAX Reconciled

Ellerslie User Group - ReST Presentation
Ellerslie User Group - ReST PresentationEllerslie User Group - ReST Presentation
Ellerslie User Group - ReST PresentationAlex Henderson
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API DevelopmentAndrew Curioso
 
Creating web APIs with apigility
Creating web APIs with apigilityCreating web APIs with apigility
Creating web APIs with apigilityKaloyan Raev
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
The Django Web Application Framework
The Django Web Application FrameworkThe Django Web Application Framework
The Django Web Application FrameworkSimon Willison
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPressTaylor Lovett
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座Li Yi
 
Quick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHPQuick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHPSanju Sony Kurian
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
03 form-data
03 form-data03 form-data
03 form-datasnopteck
 

Similar to REST and AJAX Reconciled (20)

Rails <form> Chronicle
Rails <form> ChronicleRails <form> Chronicle
Rails <form> Chronicle
 
Ellerslie User Group - ReST Presentation
Ellerslie User Group - ReST PresentationEllerslie User Group - ReST Presentation
Ellerslie User Group - ReST Presentation
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API Development
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Creating web APIs with apigility
Creating web APIs with apigilityCreating web APIs with apigility
Creating web APIs with apigility
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
The Django Web Application Framework
The Django Web Application FrameworkThe Django Web Application Framework
The Django Web Application Framework
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
 
Ws rest
Ws restWs rest
Ws rest
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Quick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHPQuick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHP
 
Doing REST Right
Doing REST RightDoing REST Right
Doing REST Right
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
03 form-data
03 form-data03 form-data
03 form-data
 
Ajax
AjaxAjax
Ajax
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 

More from Lars Trieloff

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldLars Trieloff
 
Serverless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and ClojureServerless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and ClojureLars Trieloff
 
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...Lars Trieloff
 
How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of dataLars Trieloff
 
Smartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainSmartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainLars Trieloff
 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsLars Trieloff
 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkLars Trieloff
 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtLars Trieloff
 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgLars Trieloff
 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfLars Trieloff
 
Automated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data BrusselsAutomated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data BrusselsLars Trieloff
 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamLars Trieloff
 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisLars Trieloff
 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaLars Trieloff
 
Big Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big DataBig Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big DataLars Trieloff
 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014Lars Trieloff
 
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big DataBig Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big DataLars Trieloff
 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of MarketingLars Trieloff
 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5Lars Trieloff
 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Lars Trieloff
 

More from Lars Trieloff (20)

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
 
Serverless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and ClojureServerless adventures with AWS Lambda and Clojure
Serverless adventures with AWS Lambda and Clojure
 
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
Data Natives 2015: Predictive Applications are Going to Steal Your Job: this ...
 
How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of data
 
Smartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply ChainSmartcon 2015 – Automated Decisions in the Supply Chain
Smartcon 2015 – Automated Decisions in the Supply Chain
 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive Applications
 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it Work
 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data Frankfurt
 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data Hamburg
 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
 
Automated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data BrusselsAutomated decision making with predictive applications – Big Data Brussels
Automated decision making with predictive applications – Big Data Brussels
 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data Amsterdam
 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data Paris
 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data Vienna
 
Big Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big DataBig Data Munich – Decision Automation and Big Data
Big Data Munich – Decision Automation and Big Data
 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014
 
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big DataBig Data Berlin – Automating Decisions is the Next Frontier for Big Data
Big Data Berlin – Automating Decisions is the Next Frontier for Big Data
 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of Marketing
 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5
 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

REST and AJAX Reconciled

  • 1. REST and AJAX reconciled Lars Trieloff at AJAX World East 2008
  • 4. What is REST? • Buzzword • Alternative to SOAP
  • 5. What is REST? • Buzzword • Alternative to SOAP • Representational State Transfer
  • 6. What is REST? • Buzzword • Alternative to SOAP • Representational State Transfer • Architecture of the World Wide Web
  • 7. What is REST? • Buzzword • Alternative to SOAP • Representational State Transfer • Architecture of the World Wide Web • Architecture for Scalable Network Applications
  • 8. How do we start? • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 9. Things are Resources Resource Resources can be items of information (a blog entry) or or informational descriptions of real things (a blog author)
  • 10. Resources have URIs Resource URI Uniform Resource Identifier are unique ids for resources, just like ISBN for a book or a driver’s license for a person
  • 11. Resources have Representations Representation Resource Representation URI Representations can have different formats (HTML, XML, JSON) or show different aspects of a resource.
  • 12. Representations have URLs URL URL Representation Resource Representation URI Uniform Resource Locators describe how to get to a representation of a resource, they include protocol, hostname, path and extra information
  • 13. Clients interact via Verbs GET URL POST PUT URL DELETE Representation Resource Representation URI Uniform Resource Locators describe how to get to a representation of a resource, they include protocol, hostname, path and extra information
  • 14. GET is for reading GET Representation Representation Resource Resource Before After GET is a “safe” method. There are no side-effects, and the requested resource stays unmodified.
  • 15. PUT is for replacing PUT Representation Representation Resource Resource Before After PUT is a “idempotent” method. Issuing the same PUT request multiple times yields the same result.
  • 16. DELETE is for deleting DELETE Representation Resource Before After DELETE is also “idempotent”. Deleting a resource twice yields the same result - the resource is gone.
  • 17. POST is for action POST Representation Representation Representation Resource Resource Resource Before After POST is neither safe nor idempotent. It is used for updating, creating and executing resources.
  • 18. So what? • There are unlimited resources • Every resource can be addressed • There are only four verbs • Resources have an uniform interface This makes it easy to write clients for existing REST applications and makes it easy to expose a RESTful interface to an application.
  • 19. How do we go on? • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 20. What are REST Clients • Libwww • Microsoft Internet Explorer • Apache Commons HTTPClient • Mozilla Firefox • Python httplib • Apple Safari • Ruby Net::HTTP • Opera
  • 21. HTTP Client Libraries + Full HTTP Support + Desktop Applications +Server-side mashups - Not in the web browser
  • 22. Web Browsers as HTTP Clients + No client needed +Everywhere installed - Weak HTTP Support - Web Forms 1.0 - Browser Bugs
  • 23. Web Forms 1.0 <form action=quot;/blogquot; method=quot;POSTquot; > enctype=quot;application/x-www-form-urlencodedquot; label> <label for=quot;titlequot;>Title</ > <input type=quot;textquot; name=quot;titlequot; <label for=quot;textquot;>Entry</label> <textarea name=quot;textquot;> </textarea> <input type=quot;submitquot;> </form>
  • 24. Web Forms 1.0 w do I e But ho chang <foally icrmction=g/bt ogquot; dynam ioan (tarquot; e l the act me) hofdthPe STquot;ication/x-www-form-urlencodedquot;> t =quot; O rcee coype=quot;appl resou n t? foabm for=quot;titlequot;>Title</label> <l r el > <input type=quot;textquot; name=quot;titlequot; <label for=quot;textquot;>Entry</label> <textarea name=quot;textquot;> </textarea> <input type=quot;submitquot;> </form>
  • 25. Web Forms 1.0 Why w do I e But ho chang and P do only <foally work OST m GET icrmction=g/bt ogquot; dynam ioan (tarquot; e l and P ethods DELET the act me) hofdthPe STquot;ication/x-www-formEuarencoUeda>nd t =quot; O oype=quot;appl Tquot; sourcee ct ignore - rle d re n d? fo rm? quot;titlequot;>Title</label> <label for= > <input type=quot;textquot; name=quot;titlequot; <label for=quot;textquot;>Entry</label> <textarea name=quot;textquot;> </textarea> <input type=quot;submitquot;> </form>
  • 26. Web Forms 1.0 Why w do I e But ho chang and P do only <foally work OST m GET icrmction=g/bt ogquot; dynam ioan (tarquot; e l and P ethods DELET the act me) hofdthPe STquot;ication/x-www-formEuarencoUeda>nd t =quot; O oype=quot;appl Tquot; sourcee ct ignore - rle d re n d? fo rm? quot;titlequot;>Title</label> <label for= > type=quot;textquot; name=quot;titlequot; <input <label How do I specify a for=quot;textquot;>Entry</label> different <textarea name=quot;textquot;> </textarea> encoding, for <input type=quot;submitquot;> </form> example XML or JSON?
  • 27. Solutions: • Changing the action dynamically: URI Templates • Other Methods than POST and GET: Web Forms 2.0 • More advanced encodings: Web Forms 2.0 http://bitworking.org/projects/URI-Templates/ http://www.whatwg.org/specs/web-forms/current-work/
  • 28. Solution for now: making browsers better HTTP clients using AJAX
  • 29. Where are we now? • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 30. With AJAX we can • get data-only (JSON) representations of web pages in the background • Overload Web Forms 1.0 behavior, and make them 2.0 • issue data-only (JSON) HTTP requests to these very resources
  • 31. Getting alternate Representations <head> tle> <title>REST and AJAX</ti =quot;text/jsonquot;> <link rel=quot;alterna tequot; href=quot;this.jsonquot; type criptquot;> <script type=quot;text/javas function initRest() { TagName(quot;linkquot;); var links = document.getElementsBy ntriesquot;); var entries = do cument.getElementById(quot;e for (link in links) { natequot;) { if (links[link].rel==quot;alter list of entries //pull data and populate entries with a } } } </script> </head> quot;> <body onload=quot;initRest() <ul id=quot;entriesquot;> </ul> </body>
  • 32. Overloading Forms quot; <form a ction=quot;/blog method=quot;PUTquot; enctype= quot;text/jsonquot; urn false;quot;> orm(this);ret ons ubmit=quot;RESTF Title</title> <label for=quot;titlequot;> it le</label> <label f or=quot;titlequot;>T n ame=quot;titlequot;> <input type=quot;textquot; > > Entry</label <labe l for=quot;textquot; <textarea name=quot;textquot;> </textarea> <input typ e=quot;submitquot;> </form>
  • 33. Data-only requests function RESTForm(fo rm) { var json = quot;{quot; + quot;title: quot; + form.tit le.value +quot;, quot; + quot;text: quot; + form.text .value + quot;}quot;; var xmlhttp = (windo w.XMLHttpRequest) ? new XMLHttpRequest() : ActiveXObject(quot;Micro soft.XMLHTTPquot;); xmlhttp.open(form.me thod, form.action); xmlhttp.send(json); }
  • 34. Planning RESTful AJAX applications 1. Define the domain model 2. Define Resources, Resource Types and URIs 3. Define Representations for Resources 4. Define POST behavior
  • 35. Watch out! common pitfalls and how to cope with them • Problem: Some browsers do not support PUT or DELETE requests, even as XHR • Solution: Wrap your PUT or DELETE Request in a POST request and add the X- HTTP-Method-Override Header
  • 36. Watch out! common pitfalls and how to cope with them • Problem: Some browsers do not handle 301 or 302 response codes for redirects properly • Solution: Define a format for redirection messages that wraps headers such as Location and Status codes in JSON
  • 37. What is next? • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 38. Framework Checklist frameworks can help getting the job done • Resource-based approach? • having something like /action/view/1 is a warning sign • Acknowledges existence of Representations? • you need multiple representations • Solid engineering, community, support? • without, you can do it on your own
  • 39. Framework Examples frameworks that can help getting the job done • Apache Cocoon • based on XML pipelines, URL patterns, selectors • RESTlet • Like Servlets for REST. Good for existing models • Apache Sling • based on JCR, a database for resources, with server- side scripting support
  • 40. How do we go on? • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 41. Sling with µjax • Exposes the complete JCR repository (Resource Database) as JSON tree • API for reading, creating, writing, deleting and moving Resources • Stand-alone Javascript library, plays nicely with your framework • Extra: Dojo Toolkit Integration
  • 42. µjax Core Principles I browser & ujax.js reading: json & resource GET’s writing: form-POST & GET s s J2EE Web Server 3 2 Browser I 2 UjaxServlet.java translating requests to JCR calls 3 JCR Compliant Content Repository
  • 43. µjax Core Principles I browser & ujax.js reading: json & resource GET’s writing: form-POST & GET s s J2EE Web Server 3 2 Browser I very simple js A 2 UjaxServlet.java translating requests read content, FoPI to to JCR calls r to write contenms t 3 JCR Compliant Content Repository
  • 44. µjax Core Principles I browser & ujax.js reading: json & resource GET’s writing: form-POST & GET s s J2EE Web Server 3 2 handles all the h particularly se eavy lifting, curity Browser I 16 t ons very simple js A 2 UjaxServlet.java translating requests read content, FoPI to to JCR calls r to write contenms t 3 JCR Compliant Content Repository
  • 45. Never leave without screenshots resource or http://l iented urls integration dojo widget ocalhost :7402/my data/ent ries.lis t.html
  • 46. Never leave without screenshots dojo widget integration
  • 47. What we heard today • Introduction • Core Concepts • REST Clients • AJAX REST Clients • REST Frameworks • REST Frameworks for AJAX
  • 48. Thank you very much lars.trieloff@day.com For more information, see my weblog at http://weblogs.goshaky.com/weblog/lars