SlideShare uma empresa Scribd logo
1 de 52
Baixar para ler offline
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




               RESTful Web Apps
               Facts vs Fiction

               Subbu Allamaraju
               Yahoo! Inc || http://subbu.org




Subbu Allamaraju - RESTful Web Applications
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                About
   Tech Yahoo!
          Developing standards, patterns and
           practices for HTTP web APIs
   Past
          Developer – web services and Java
          Standards contributor at BEA
          Wrote books on JEE web tier (so long ago)
   Current Passion
          HTTP and REST
Subbu Allamaraju – RESTful Web Apps                              Slide 2
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Disclaimer


   All the opinions I express here are mine
   and do not necessarily represent those
       of my present or past employers.




Subbu Allamaraju – RESTful Web Apps                              3
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                A Confession
   Not a web developer
   Not directly interested in the internals
    of web frameworks
   Only interested in the visible aspects of
    web apps




Subbu Allamaraju – RESTful Web Apps                              4
Colorado Software Summit: October 19 – 24, 2008    © Copyright 2008, Yahoo! Inc.




                Agenda


                                REST – The Architecture




                  About RESTfulness of Web Apps



Subbu Allamaraju – RESTful Web Apps                               5
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Some History
 1945 - Vannevar Bush
   arbitrary linking between pieces of information
 1965 – Ted Nelson (Xanadu fame)
   hypertext and hypermedia
 1990s – Tim Berners-Lee, Roy Fielding et. al.
   WWW, HTML, HTTP and URI
   HTTP 1.1 - RFC 2616
   URI - RFC 2396 (superceded by 3986)
 2000 – Roy Fielding
   Representational State Transfer


Subbu Allamaraju – RESTful Web Apps                              6
Colorado Software Summit: October 19 – 24, 2008                © Copyright 2008, Yahoo! Inc.




                Two Sides
       RPC                                        HTTP, URI, WWW

                                                  REST      Web frameworks

                          SOAP                               MVC
                        “Pragmatic                                     This
                          WS-*
                          REST”                                       session
                                                              Web 2.0
                                         REST                + REST URIs
                                                             (?)

                               Machine Facing Human Facing
Subbu Allamaraju – RESTful Web Apps                                           7
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




       WEB IS MOSTLY RESTFUL




Subbu Allamaraju – RESTful Web Apps                              8
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Being RESTful
 Resources
   Named via URIs Uniquely identify resources
   Have representations Mostly one/resource
     Reflect the state of the app
                                     HATEOAS
     Contain contextual links
 Uniform interface Generic, Client-Server
   Idempotent, safe, cacheable …


Subbu Allamaraju – RESTful Web Apps                              9
Colorado Software Summit: October 19 – 24, 2008        © Copyright 2008, Yahoo! Inc.




                Resources and URIs
   Resources and URIs
          A blog post, an image, a catalog, a shopping cart



                                    Some personalized, but most are
                                     not
                                    Some depend on sessions, but
                                     most do not



Subbu Allamaraju – RESTful Web Apps                                   10
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Cost of Personalized UI
                             http://my.example.org
                                       vs
                         http://www.example.org/subbu




Subbu Allamaraju – RESTful Web Apps                              11
Colorado Software Summit: October 19 – 24, 2008                   © Copyright 2008, Yahoo! Inc.




                Representations
   Rich of representations
          HTML, XML, JS, PDF, CSS, Flash, …

                                           Poor content negotiation
                                           Agent-driven negotiation +
                                             Poor negotiation headers
                                           Media types on responses
                                             ignored sometimes
                                             Constrained by HTML
                                           <a href=“mydoc.pdf”>Click</a>
                                             <a href=“myfeed.rss”>RSS Feed</a>
                                             <a href=“myfeed.atom”>Atom Feed</a>

Subbu Allamaraju – RESTful Web Apps                                              12
Colorado Software Summit: October 19 – 24, 2008       © Copyright 2008, Yahoo! Inc.




                Hypermedia and HATEOAS
   Rich Hypermedia
          Links and forms
          Contextual
   Auto-discoverable
          <link/>, microformats


                                    Except some new breed of Web
                                     Too Oh + REST goo


Subbu Allamaraju – RESTful Web Apps                                  13
Colorado Software Summit: October 19 – 24, 2008        © Copyright 2008, Yahoo! Inc.




                Uniform Interface
   Links and Forms
          GET and POST


                                    Still some misconceptions (e.g.
                                     POST is secure)
                                    Idempotency? Safety?
                                    GET URIs not always refreshable
                                    Still fighting the back button


Subbu Allamaraju – RESTful Web Apps                                   14
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Back Button
 Cache-Control: no-cache,no-store




 Redirect after POST
  a.k.a. PRG (POST/redirect/GET)




Subbu Allamaraju – RESTful Web Apps                              15
Colorado Software Summit: October 19 – 24, 2008           © Copyright 2008, Yahoo! Inc.




                Caching
   Web is read-most
   Cacheable
   Widely discussed

                                       Yet moderately ignored
                                       Cache busting
                                       Cache-ignorant frameworks
                                       Frameworks that prefer backend
                                        caching over HTTP caching

Subbu Allamaraju – RESTful Web Apps                                      16
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Caching Choices
   Back-end caching
          Non-uniform interface
          Need to explicitly program to it
   HTTP caching
          Uniform interface
          Pluggable




Subbu Allamaraju – RESTful Web Apps                              17
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Ajax Apps
   More opportunities to be RESTful
          Full support for the uniform interface
          Content negotiation, optimistic
           concurrency, caching
          HATEOAS
                 • Can loosen this constraint as long as the client
                   code is downloaded from the same server/app




Subbu Allamaraju – RESTful Web Apps                              18
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Cross-Domain Hacks
   script, iframe
   Tunnel requests over GET




Subbu Allamaraju – RESTful Web Apps                              19
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Web is Mostly RESTful
 Take advantage of the web arch



                        Breaking is EXPENSIVE
                        Breaking is CONFUSING
                        Breaking LOWERS expectations




Subbu Allamaraju – RESTful Web Apps                              20
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




       WEB FRAMEWORKS




Subbu Allamaraju – RESTful Web Apps                              21
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                State of Affairs

    Ease of programming



               Fragmentation and confusion


                          Innovation vs Correctness



Subbu Allamaraju – RESTful Web Apps                              22
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Circa 1997-
   There were servlets
   Basic plumbing, closely reflecting HTTP
    1.1
   A poor programming model
   But allowed a lot of frameworks to be
    built on top




Subbu Allamaraju – RESTful Web Apps                              23
Colorado Software Summit: October 19 – 24, 2008                     © Copyright 2008, Yahoo! Inc.




                Circa 2001-




                                                  Action Oriented


Subbu Allamaraju – RESTful Web Apps                                                24
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Circa 2004-
   Enter JSF & Co.
          A component based UI framework
   With known limitations
          Complex
          Slow
          Uses POST for almost everything
          And so on…
   Third-party patches

Subbu Allamaraju – RESTful Web Apps                              25
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Design Choice




Subbu Allamaraju – RESTful Web Apps                              26
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Where to keep this stuff?




Subbu Allamaraju – RESTful Web Apps                              27
Colorado Software Summit: October 19 – 24, 2008              © Copyright 2008, Yahoo! Inc.




                Consequence



                                                  We know.
                                                  So what?




Subbu Allamaraju – RESTful Web Apps                                         28
Colorado Software Summit: October 19 – 24, 2008                          © Copyright 2008, Yahoo! Inc.




                URI Overloading


                                                                     Resource
                        Client 1
                                                                      (URI)
                                                  Representation



                                                                     Resource
                        Client 2
                                                                      (URI)
                                                  Different
                                                  Representation
                                                  How was this chosen?



Subbu Allamaraju – RESTful Web Apps                                                     29
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                URI Overloading
   One URI – multiple representations
          No way to tell how a representation was
           chosen
          Can get wrong content from a cache
   HTTP does allow URI overloading
          Content negotiation aka “conneg”




Subbu Allamaraju – RESTful Web Apps                              30
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Content Negotiation

       Accept: application/atom+xml;q=1.0,text/html;q=0.1
       Accept-Charset: UTF-8
       Accept-Language: fr;q=1.0,en=0.8
       Accept-Encoding: gzip,deflate


            
Content-Type: application/atom+xml;charset=UTF-8
            
Content-Encoding: deflate
             Vary: Accept,Accept-Encoding




Subbu Allamaraju – RESTful Web Apps                              31
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Some Options
   Vary by cookie
          Not always recognized by caches
          Complex given the parameters in a cookie
                 • Domain, path, life time etc
   URLEncode
          Encode session ID into URIs
                 • ;jsessionid=d8sdasg7312
   Cache-control: no-cache,no-store

Subbu Allamaraju – RESTful Web Apps                              32
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                JSF Compromise

 <context-param>
    <param-name>
        javax.faces.STATE_SAVING_METHOD
    </param-name>
    <param-value>
        client
    </param-value>
 </context-param>




Subbu Allamaraju – RESTful Web Apps                              33
Colorado Software Summit: October 19 – 24, 2008                       © Copyright 2008, Yahoo! Inc.




                Implementation
                                                  Every request must be a POST



<form method=quot;POSTquot; action=quot;…quot;
   enctype=quot;…quot;>
   <input type=quot;hiddenquot; 
       name=quot;javax.faces.ViewState” 
       value=quot;H4s…zogsAAA==quot; />

   …
                                             State stuffed into forms as a
</form>
                                          hidden field




Subbu Allamaraju – RESTful Web Apps                                                  34
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Consequence



                        Breaks the uniform interface




Subbu Allamaraju – RESTful Web Apps                              35
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                JSF vs REST
   Caught between two extremes
          URIs no longer sufficient to identify a
           resource
          Interactions assume existence of session
           state – i.e. no longer stateless
          Uniform interface limited to POST
          Interactions not idempotent
          Representations not cacheable


Subbu Allamaraju – RESTful Web Apps                              36
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                JSF – Takeaway
   Focused heavily on a UI component
    model (AWT for the Web)
   Misinterpreted the web architecture
   Made some fundamental questionable
    choices
   You can patch, but can not fix
          15+ Ajax patches!



Subbu Allamaraju – RESTful Web Apps                              37
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




       WEB 2.0 MOTIVATED




Subbu Allamaraju – RESTful Web Apps                              38
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT
   A cross-compilation based framework
          Write Java – generate JavaScript
          Mashes up client and server code into
           single source
          These layers communicate using GWT-RPC
   Typical RPC concern does not apply
          Coupling due to code generation
          Client downloaded from the same app


Subbu Allamaraju – RESTful Web Apps                              39
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT-RPC


 Object result = someServ.doIt(new MyCallback());
 public class MyCallback extends AsyncCallback() 
 {
    public void onsuccess(Object result) 
    {
       ...
    }
 }




Subbu Allamaraju – RESTful Web Apps                              40
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT-RPC over HTTP




Subbu Allamaraju – RESTful Web Apps                              41
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT-RPC over HTTP
   Method calls POSTed to the server
          Transport object graphs
          Uses HTTP like a transport layer
   Non uniform interface




Subbu Allamaraju – RESTful Web Apps                              42
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT – Request Builder


 String url = quot;...quot;;
 RequestBuilder builder =
                new RequestBuilder(RequestBuilder.GET, 
                                   URL.encode(url));
 builder.sendRequest(data, callback);




Subbu Allamaraju – RESTful Web Apps                              43
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                RequestBuilder over HTTP
   More control over HTTP requests
   Supports GET and POST
   Allows so-called RESTful layers
          GWT-REST
          GWT-Restlet




Subbu Allamaraju – RESTful Web Apps                              44
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                GWT Takeway
   Focused heavily on ease of use
          Javascript agnostic
   Modeled after RPC
          Breaks uniform interface
          Backend caching over HTTP caching
   Fixable




Subbu Allamaraju – RESTful Web Apps                              45
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Fixing GWT?

 Object result = someServ.doGet(new MyCallback());

 Object result = someServ.doPost(new MyCallback());

 Object result = someServ.doPut(new MyCallback());

 Object result = someServ.doDelete(new MyCallback());

 Object result = someServ.doHead(new MyCallback());




Subbu Allamaraju – RESTful Web Apps                              46
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                SOFEA
   Central premise – SOA
          Business logic as reusable services
                 • Change less often
          Presentation app calling those services
                 • Change more often
          Separation of concerns and Loose coupling
   Misinterprets HATEOAS



Subbu Allamaraju – RESTful Web Apps                              47
Colorado Software Summit: October 19 – 24, 2008                     © Copyright 2008, Yahoo! Inc.




                HATEOAS vs SOFEA
                                                                 Download server
                                                  App download




                    App flow
                                                      Data
                                                  interchange



                                                                 Business logic
                                                                 server
             App container




Subbu Allamaraju – RESTful Web Apps                                                48
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Appcelerator
   A SOFEA style framework with RoR like
    usability
          Attend Matt Riable’s session on “Building
           Rich Internet Applications with
           Appcelerator”
   SOAP/HTTP style
          Message passing
          POST to a single URI


Subbu Allamaraju – RESTful Web Apps                              49
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                XML over POST




Subbu Allamaraju – RESTful Web Apps                              50
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Interesting … but
   Loosens HATEOAS
          Hypermedia to Code + Data
   Introduces a different kind of coupling
          Clients deal with POX and not links
          Breaks URI opacity
   Examples
          Appcelerator – SOAP like
          http://www.applebox.com.au - uses SOAP/POST
          http://www.contactoffice.com - uses XML/POST


Subbu Allamaraju – RESTful Web Apps                              51
Colorado Software Summit: October 19 – 24, 2008   © Copyright 2008, Yahoo! Inc.




                Thanks
   Don’t fight the architecture
          Innovate, enhance
          Don’t break
          Or break judiciously




Subbu Allamaraju – RESTful Web Apps                              52

Mais conteúdo relacionado

Destaque

Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
WP REST API: Actionable.co
WP REST API: Actionable.coWP REST API: Actionable.co
WP REST API: Actionable.coShawn Hooper
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural StyleRobert Wilson
 
Teach a Dog to REST
Teach a Dog to RESTTeach a Dog to REST
Teach a Dog to RESTBrian Mulloy
 
REST 101: An Overview To Representational State Transfer.
REST 101: An Overview To Representational State Transfer.REST 101: An Overview To Representational State Transfer.
REST 101: An Overview To Representational State Transfer.Omar Fernando Zafe
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
REST to RESTful Web Service
REST to RESTful Web ServiceREST to RESTful Web Service
REST to RESTful Web Service家弘 周
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Restdeimos
 
ReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedDhananjay Nene
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsStormpath
 
HATEOAS 101 - Opinionated Introduction to a REST API Style
HATEOAS 101 - Opinionated Introduction to a REST API StyleHATEOAS 101 - Opinionated Introduction to a REST API Style
HATEOAS 101 - Opinionated Introduction to a REST API StyleApigee | Google Cloud
 

Destaque (13)

Pragmatic Rest
Pragmatic RestPragmatic Rest
Pragmatic Rest
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
WP REST API: Actionable.co
WP REST API: Actionable.coWP REST API: Actionable.co
WP REST API: Actionable.co
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Teach a Dog to REST
Teach a Dog to RESTTeach a Dog to REST
Teach a Dog to REST
 
REST 101: An Overview To Representational State Transfer.
REST 101: An Overview To Representational State Transfer.REST 101: An Overview To Representational State Transfer.
REST 101: An Overview To Representational State Transfer.
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
REST to RESTful Web Service
REST to RESTful Web ServiceREST to RESTful Web Service
REST to RESTful Web Service
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Rest
 
ReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedReST (Representational State Transfer) Explained
ReST (Representational State Transfer) Explained
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
HATEOAS 101 - Opinionated Introduction to a REST API Style
HATEOAS 101 - Opinionated Introduction to a REST API StyleHATEOAS 101 - Opinionated Introduction to a REST API Style
HATEOAS 101 - Opinionated Introduction to a REST API Style
 

Semelhante a RESTful Web Apps - Facts vs Fiction

Yahoo Developer Network overview
Yahoo Developer Network overviewYahoo Developer Network overview
Yahoo Developer Network overviewChristian Heilmann
 
Search Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black MagicSearch Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black Magicguestb1f3a
 
Beyond web services: supporting mashup artists at Yahoo!
Beyond web services: supporting mashup artists at Yahoo!Beyond web services: supporting mashup artists at Yahoo!
Beyond web services: supporting mashup artists at Yahoo!Chad Dickerson
 
Apache Solr Changes the Way You Build Sites
Apache Solr Changes the Way You Build SitesApache Solr Changes the Way You Build Sites
Apache Solr Changes the Way You Build SitesPeter
 
Have Some Rest Building Web2.0 Apps And Services
Have Some Rest   Building Web2.0 Apps And ServicesHave Some Rest   Building Web2.0 Apps And Services
Have Some Rest Building Web2.0 Apps And ServicesNenad Nikolic
 
REST Introduction (PHP London)
REST Introduction (PHP London)REST Introduction (PHP London)
REST Introduction (PHP London)Paul James
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soaumityalcinalp
 
Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Juan Sanchez
 
Web Publishing: An Overview of Tools and Service
Web Publishing: An Overview of Tools and ServiceWeb Publishing: An Overview of Tools and Service
Web Publishing: An Overview of Tools and Servicekilmeny21
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principleelliando dias
 
Web Performance 101
Web Performance 101Web Performance 101
Web Performance 101Uri Lavi
 
OneSpring: 5 Myths of Rich Internet Applications
OneSpring:  5 Myths of Rich Internet ApplicationsOneSpring:  5 Myths of Rich Internet Applications
OneSpring: 5 Myths of Rich Internet ApplicationsOneSpring LLC
 
InsideRIA Outlook for 2009
InsideRIA Outlook for 2009InsideRIA Outlook for 2009
InsideRIA Outlook for 2009AndreCharland
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpinrajivmordani
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Datadeimos
 
Web 2.0 Impact on the Enterprise
Web 2.0 Impact on the EnterpriseWeb 2.0 Impact on the Enterprise
Web 2.0 Impact on the EnterpriseDaan De Brouckere
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawnozten
 
Best And Worst Practices Building Ria with Adobe and Microsoft
Best And Worst Practices Building Ria with Adobe and MicrosoftBest And Worst Practices Building Ria with Adobe and Microsoft
Best And Worst Practices Building Ria with Adobe and MicrosoftJosh Holmes
 

Semelhante a RESTful Web Apps - Facts vs Fiction (20)

Yahoo Developer Network overview
Yahoo Developer Network overviewYahoo Developer Network overview
Yahoo Developer Network overview
 
Search Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black MagicSearch Engines and Flash: Secrets, Tricks, and Black Magic
Search Engines and Flash: Secrets, Tricks, and Black Magic
 
Beyond web services: supporting mashup artists at Yahoo!
Beyond web services: supporting mashup artists at Yahoo!Beyond web services: supporting mashup artists at Yahoo!
Beyond web services: supporting mashup artists at Yahoo!
 
Apache Solr Changes the Way You Build Sites
Apache Solr Changes the Way You Build SitesApache Solr Changes the Way You Build Sites
Apache Solr Changes the Way You Build Sites
 
Have Some Rest Building Web2.0 Apps And Services
Have Some Rest   Building Web2.0 Apps And ServicesHave Some Rest   Building Web2.0 Apps And Services
Have Some Rest Building Web2.0 Apps And Services
 
REST Introduction (PHP London)
REST Introduction (PHP London)REST Introduction (PHP London)
REST Introduction (PHP London)
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soa
 
Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4Prototyping Adobe AIR Applications with Fireworks CS4
Prototyping Adobe AIR Applications with Fireworks CS4
 
Web Publishing: An Overview of Tools and Service
Web Publishing: An Overview of Tools and ServiceWeb Publishing: An Overview of Tools and Service
Web Publishing: An Overview of Tools and Service
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
 
Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Web Performance 101
Web Performance 101Web Performance 101
Web Performance 101
 
OneSpring: 5 Myths of Rich Internet Applications
OneSpring:  5 Myths of Rich Internet ApplicationsOneSpring:  5 Myths of Rich Internet Applications
OneSpring: 5 Myths of Rich Internet Applications
 
InsideRIA Outlook for 2009
InsideRIA Outlook for 2009InsideRIA Outlook for 2009
InsideRIA Outlook for 2009
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpin
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
 
Faster web pages
Faster web pagesFaster web pages
Faster web pages
 
Web 2.0 Impact on the Enterprise
Web 2.0 Impact on the EnterpriseWeb 2.0 Impact on the Enterprise
Web 2.0 Impact on the Enterprise
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 
Best And Worst Practices Building Ria with Adobe and Microsoft
Best And Worst Practices Building Ria with Adobe and MicrosoftBest And Worst Practices Building Ria with Adobe and Microsoft
Best And Worst Practices Building Ria with Adobe and Microsoft
 

Mais de Subbu Allamaraju

What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)Subbu Allamaraju
 
Are We Ready for Serverless
Are We Ready for ServerlessAre We Ready for Serverless
Are We Ready for ServerlessSubbu Allamaraju
 
How to Sell Serverless to Your Colleagues
How to Sell Serverless to Your ColleaguesHow to Sell Serverless to Your Colleagues
How to Sell Serverless to Your ColleaguesSubbu Allamaraju
 
Turning Containers into Cattle
Turning Containers into CattleTurning Containers into Cattle
Turning Containers into CattleSubbu Allamaraju
 
Keystone at the Center of Our Universe
Keystone at the Center of Our UniverseKeystone at the Center of Our Universe
Keystone at the Center of Our UniverseSubbu Allamaraju
 
Journey and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPalJourney and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPalSubbu Allamaraju
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work TogetherSubbu Allamaraju
 
ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale Subbu Allamaraju
 

Mais de Subbu Allamaraju (16)

Five Rules
Five RulesFive Rules
Five Rules
 
Leading a Transformation
Leading a TransformationLeading a Transformation
Leading a Transformation
 
Taming the Rate of Change
Taming the Rate of ChangeTaming the Rate of Change
Taming the Rate of Change
 
What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)What Worked for Netflix May Not Work for You (OSCON-2018)
What Worked for Netflix May Not Work for You (OSCON-2018)
 
Are We Ready for Serverless
Are We Ready for ServerlessAre We Ready for Serverless
Are We Ready for Serverless
 
How to Sell Serverless to Your Colleagues
How to Sell Serverless to Your ColleaguesHow to Sell Serverless to Your Colleagues
How to Sell Serverless to Your Colleagues
 
Turning Containers into Cattle
Turning Containers into CattleTurning Containers into Cattle
Turning Containers into Cattle
 
Keystone at the Center of Our Universe
Keystone at the Center of Our UniverseKeystone at the Center of Our Universe
Keystone at the Center of Our Universe
 
Journey and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPalJourney and future of OpenStack eBay and PayPal
Journey and future of OpenStack eBay and PayPal
 
Engineering operations
Engineering operationsEngineering operations
Engineering operations
 
Open stack@ebay
Open stack@ebayOpen stack@ebay
Open stack@ebay
 
Making Things Work Together
Making Things Work TogetherMaking Things Work Together
Making Things Work Together
 
ql.io at NodePDX
ql.io at NodePDXql.io at NodePDX
ql.io at NodePDX
 
ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale ql.io: Consuming HTTP at Scale
ql.io: Consuming HTTP at Scale
 
Measuring REST
Measuring RESTMeasuring REST
Measuring REST
 
REST: Theory vs Practice
REST: Theory vs PracticeREST: Theory vs Practice
REST: Theory vs Practice
 

Último

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Último (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
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!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

RESTful Web Apps - Facts vs Fiction

  • 1. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. RESTful Web Apps Facts vs Fiction Subbu Allamaraju Yahoo! Inc || http://subbu.org Subbu Allamaraju - RESTful Web Applications
  • 2. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. About   Tech Yahoo!  Developing standards, patterns and practices for HTTP web APIs   Past  Developer – web services and Java  Standards contributor at BEA  Wrote books on JEE web tier (so long ago)   Current Passion  HTTP and REST Subbu Allamaraju – RESTful Web Apps Slide 2
  • 3. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Disclaimer All the opinions I express here are mine and do not necessarily represent those of my present or past employers. Subbu Allamaraju – RESTful Web Apps 3
  • 4. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. A Confession   Not a web developer   Not directly interested in the internals of web frameworks   Only interested in the visible aspects of web apps Subbu Allamaraju – RESTful Web Apps 4
  • 5. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Agenda REST – The Architecture About RESTfulness of Web Apps Subbu Allamaraju – RESTful Web Apps 5
  • 6. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Some History 1945 - Vannevar Bush arbitrary linking between pieces of information 1965 – Ted Nelson (Xanadu fame) hypertext and hypermedia 1990s – Tim Berners-Lee, Roy Fielding et. al. WWW, HTML, HTTP and URI HTTP 1.1 - RFC 2616 URI - RFC 2396 (superceded by 3986) 2000 – Roy Fielding Representational State Transfer Subbu Allamaraju – RESTful Web Apps 6
  • 7. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Two Sides RPC HTTP, URI, WWW REST Web frameworks SOAP MVC “Pragmatic This WS-* REST” session Web 2.0 REST + REST URIs (?) Machine Facing Human Facing Subbu Allamaraju – RESTful Web Apps 7
  • 8. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. WEB IS MOSTLY RESTFUL Subbu Allamaraju – RESTful Web Apps 8
  • 9. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Being RESTful Resources Named via URIs Uniquely identify resources Have representations Mostly one/resource Reflect the state of the app HATEOAS Contain contextual links Uniform interface Generic, Client-Server Idempotent, safe, cacheable … Subbu Allamaraju – RESTful Web Apps 9
  • 10. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Resources and URIs   Resources and URIs  A blog post, an image, a catalog, a shopping cart   Some personalized, but most are not   Some depend on sessions, but most do not Subbu Allamaraju – RESTful Web Apps 10
  • 11. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Cost of Personalized UI http://my.example.org vs http://www.example.org/subbu Subbu Allamaraju – RESTful Web Apps 11
  • 12. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Representations   Rich of representations  HTML, XML, JS, PDF, CSS, Flash, …   Poor content negotiation   Agent-driven negotiation + Poor negotiation headers   Media types on responses ignored sometimes Constrained by HTML   <a href=“mydoc.pdf”>Click</a> <a href=“myfeed.rss”>RSS Feed</a> <a href=“myfeed.atom”>Atom Feed</a> Subbu Allamaraju – RESTful Web Apps 12
  • 13. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Hypermedia and HATEOAS   Rich Hypermedia  Links and forms  Contextual   Auto-discoverable  <link/>, microformats   Except some new breed of Web Too Oh + REST goo Subbu Allamaraju – RESTful Web Apps 13
  • 14. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Uniform Interface   Links and Forms  GET and POST   Still some misconceptions (e.g. POST is secure)   Idempotency? Safety?   GET URIs not always refreshable   Still fighting the back button Subbu Allamaraju – RESTful Web Apps 14
  • 15. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Back Button Cache-Control: no-cache,no-store Redirect after POST a.k.a. PRG (POST/redirect/GET) Subbu Allamaraju – RESTful Web Apps 15
  • 16. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Caching   Web is read-most   Cacheable   Widely discussed   Yet moderately ignored   Cache busting   Cache-ignorant frameworks   Frameworks that prefer backend caching over HTTP caching Subbu Allamaraju – RESTful Web Apps 16
  • 17. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Caching Choices   Back-end caching  Non-uniform interface  Need to explicitly program to it   HTTP caching  Uniform interface  Pluggable Subbu Allamaraju – RESTful Web Apps 17
  • 18. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Ajax Apps   More opportunities to be RESTful  Full support for the uniform interface  Content negotiation, optimistic concurrency, caching  HATEOAS • Can loosen this constraint as long as the client code is downloaded from the same server/app Subbu Allamaraju – RESTful Web Apps 18
  • 19. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Cross-Domain Hacks   script, iframe   Tunnel requests over GET Subbu Allamaraju – RESTful Web Apps 19
  • 20. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Web is Mostly RESTful Take advantage of the web arch Breaking is EXPENSIVE Breaking is CONFUSING Breaking LOWERS expectations Subbu Allamaraju – RESTful Web Apps 20
  • 21. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. WEB FRAMEWORKS Subbu Allamaraju – RESTful Web Apps 21
  • 22. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. State of Affairs Ease of programming Fragmentation and confusion Innovation vs Correctness Subbu Allamaraju – RESTful Web Apps 22
  • 23. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Circa 1997-   There were servlets   Basic plumbing, closely reflecting HTTP 1.1   A poor programming model   But allowed a lot of frameworks to be built on top Subbu Allamaraju – RESTful Web Apps 23
  • 24. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Circa 2001- Action Oriented Subbu Allamaraju – RESTful Web Apps 24
  • 25. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Circa 2004-   Enter JSF & Co.  A component based UI framework   With known limitations  Complex  Slow  Uses POST for almost everything  And so on…   Third-party patches Subbu Allamaraju – RESTful Web Apps 25
  • 26. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Design Choice Subbu Allamaraju – RESTful Web Apps 26
  • 27. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Where to keep this stuff? Subbu Allamaraju – RESTful Web Apps 27
  • 28. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Consequence We know. So what? Subbu Allamaraju – RESTful Web Apps 28
  • 29. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. URI Overloading Resource Client 1 (URI) Representation Resource Client 2 (URI) Different Representation How was this chosen? Subbu Allamaraju – RESTful Web Apps 29
  • 30. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. URI Overloading   One URI – multiple representations  No way to tell how a representation was chosen  Can get wrong content from a cache   HTTP does allow URI overloading  Content negotiation aka “conneg” Subbu Allamaraju – RESTful Web Apps 30
  • 31. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Content Negotiation Accept: application/atom+xml;q=1.0,text/html;q=0.1 Accept-Charset: UTF-8 Accept-Language: fr;q=1.0,en=0.8 Accept-Encoding: gzip,deflate Content-Type: application/atom+xml;charset=UTF-8 Content-Encoding: deflate Vary: Accept,Accept-Encoding Subbu Allamaraju – RESTful Web Apps 31
  • 32. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Some Options   Vary by cookie  Not always recognized by caches  Complex given the parameters in a cookie • Domain, path, life time etc   URLEncode  Encode session ID into URIs • ;jsessionid=d8sdasg7312   Cache-control: no-cache,no-store Subbu Allamaraju – RESTful Web Apps 32
  • 33. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. JSF Compromise <context-param> <param-name> javax.faces.STATE_SAVING_METHOD </param-name> <param-value> client </param-value> </context-param> Subbu Allamaraju – RESTful Web Apps 33
  • 34. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Implementation Every request must be a POST <form method=quot;POSTquot; action=quot;…quot; enctype=quot;…quot;> <input type=quot;hiddenquot; name=quot;javax.faces.ViewState” value=quot;H4s…zogsAAA==quot; /> … State stuffed into forms as a </form> hidden field Subbu Allamaraju – RESTful Web Apps 34
  • 35. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Consequence Breaks the uniform interface Subbu Allamaraju – RESTful Web Apps 35
  • 36. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. JSF vs REST   Caught between two extremes  URIs no longer sufficient to identify a resource  Interactions assume existence of session state – i.e. no longer stateless  Uniform interface limited to POST  Interactions not idempotent  Representations not cacheable Subbu Allamaraju – RESTful Web Apps 36
  • 37. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. JSF – Takeaway   Focused heavily on a UI component model (AWT for the Web)   Misinterpreted the web architecture   Made some fundamental questionable choices   You can patch, but can not fix  15+ Ajax patches! Subbu Allamaraju – RESTful Web Apps 37
  • 38. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. WEB 2.0 MOTIVATED Subbu Allamaraju – RESTful Web Apps 38
  • 39. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT   A cross-compilation based framework  Write Java – generate JavaScript  Mashes up client and server code into single source  These layers communicate using GWT-RPC   Typical RPC concern does not apply  Coupling due to code generation  Client downloaded from the same app Subbu Allamaraju – RESTful Web Apps 39
  • 40. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT-RPC Object result = someServ.doIt(new MyCallback()); public class MyCallback extends AsyncCallback() { public void onsuccess(Object result) { ... } } Subbu Allamaraju – RESTful Web Apps 40
  • 41. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT-RPC over HTTP Subbu Allamaraju – RESTful Web Apps 41
  • 42. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT-RPC over HTTP   Method calls POSTed to the server  Transport object graphs  Uses HTTP like a transport layer   Non uniform interface Subbu Allamaraju – RESTful Web Apps 42
  • 43. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT – Request Builder String url = quot;...quot;; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url)); builder.sendRequest(data, callback); Subbu Allamaraju – RESTful Web Apps 43
  • 44. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. RequestBuilder over HTTP   More control over HTTP requests   Supports GET and POST   Allows so-called RESTful layers  GWT-REST  GWT-Restlet Subbu Allamaraju – RESTful Web Apps 44
  • 45. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. GWT Takeway   Focused heavily on ease of use  Javascript agnostic   Modeled after RPC  Breaks uniform interface  Backend caching over HTTP caching   Fixable Subbu Allamaraju – RESTful Web Apps 45
  • 46. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Fixing GWT? Object result = someServ.doGet(new MyCallback()); Object result = someServ.doPost(new MyCallback()); Object result = someServ.doPut(new MyCallback()); Object result = someServ.doDelete(new MyCallback()); Object result = someServ.doHead(new MyCallback()); Subbu Allamaraju – RESTful Web Apps 46
  • 47. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. SOFEA   Central premise – SOA  Business logic as reusable services • Change less often  Presentation app calling those services • Change more often  Separation of concerns and Loose coupling   Misinterprets HATEOAS Subbu Allamaraju – RESTful Web Apps 47
  • 48. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. HATEOAS vs SOFEA Download server App download App flow Data interchange Business logic server App container Subbu Allamaraju – RESTful Web Apps 48
  • 49. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Appcelerator   A SOFEA style framework with RoR like usability  Attend Matt Riable’s session on “Building Rich Internet Applications with Appcelerator”   SOAP/HTTP style  Message passing  POST to a single URI Subbu Allamaraju – RESTful Web Apps 49
  • 50. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. XML over POST Subbu Allamaraju – RESTful Web Apps 50
  • 51. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Interesting … but   Loosens HATEOAS  Hypermedia to Code + Data   Introduces a different kind of coupling  Clients deal with POX and not links  Breaks URI opacity   Examples  Appcelerator – SOAP like  http://www.applebox.com.au - uses SOAP/POST  http://www.contactoffice.com - uses XML/POST Subbu Allamaraju – RESTful Web Apps 51
  • 52. Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Yahoo! Inc. Thanks   Don’t fight the architecture  Innovate, enhance  Don’t break  Or break judiciously Subbu Allamaraju – RESTful Web Apps 52