RESTFul WebApp Concept
Upcoming SlideShare
Loading in...5
×
 

RESTFul WebApp Concept

on

  • 467 views

 

Statistics

Views

Total Views
467
Views on SlideShare
467
Embed Views
0

Actions

Likes
1
Downloads
9
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    RESTFul WebApp Concept RESTFul WebApp Concept Presentation Transcript

    • Dian Wahyu Aditya [email_address] REST v 2.3
    • Agenda
      • REST
        • Overview
        • Core Concept
        • Web Service
      • Demo
        • Struts2
        • Spring MVC
        • Android Client
    • REST?
        Representational State Transfer # Defined by Roy T. Fielding in his doctoral dissertation.
          (Co-founder of Apache HTTP Project)
        An Architectural Style
    • REST?
        Representational State Transfer #Use HTTP, URI, and other web standard correctly
      Web Used Correctly
    • REST
        CORE CONCEPT
    • REST: Core Concept
        “ Things are Resources” Resources can be items of information (a blog entry) or informational descriptions of real things (a blog author)
      RESOURCE
    • REST: Core Concept
        “ Resource Have URIs” Uniform Resource Identifier are unique ids for resources.
      RESOURCE U R I
    • REST: Core Concept
        “ Resources have Representation” Representations can have different formats (HTML, XML, JSON).
      RESOURCE U R I REPRESENTATION REPRESENTATION
    • REST: Core Concept
        “ Representations have URLs” Uniform Resource Locators describe how to get to a representation of a resource, they include protocol, hostname, path and extra information.
      RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL
    • REST: Core Concept
        “ Client interact via Verbs”
      RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL POST GET PUT DELETE
    • RESTFul
        Web Service
    • RESTFul Web Service
        “ Use HTTP Standard Methods”
      Retrieve GET Update PUT Create POST Remove DELETE
    • RESTFul Web Service
        “ Use Standard Methods / Uniform Interface”
      Safe GET Idempotent PUT Idempotent DELETE
    • RESTFul Web Service
        “ Use Standard Methods / Uniform Interface” Safe method # There are no side-effects # The requested resource stays unmodified Idempotent # Issuing the same request multiple times yields the same result
    • RESTFul Web Service
        “ All About the URIs” http://blog.mervpolis.com/roller/dwx http://blog.mervpolis.com/roller/dwx/category/Java http://blog.mervpolis.com/roller/dwx/date/201009 http://blog.mervpolis.com/roller/dwx/entry/hibernate_event_listener
      Directory Structure-like URIs To the Point Easy to Guess
    • RESTFul Web Service GET /deleteuser?name=Robert HTTP/1.1 DELETE /user/Robert HTTP/1.1
    • RESTFul Web Service
        “ Uniform Interface”
    • RESTFul Web Service
        “ Stateless”
      GET /resources/getNextPage? HTTP/1.1 Client Web service <?xml version=”1.0” ?> <rsp stat=”ok”> <resource id=”1” /> <resource id=”2” /> ... <rsp> PreviousPage++; NextPage= previousPage; return nextPage Stateful design
    • RESTFul Web Service
        “ Stateless”
      GET /resources/?page=2 HTTP/1.1 Client Web service <?xml version=”1.0” ?> <rsp page=”2” nextPage = “3” > <resource id=”1” /> <resource id=”2” /> ... <rsp> getPage(2); Stateless design
    • RESTFul Web Service
        “ Allow Multiple Representation” GET /technology Host: www.telegraph.co.uk Accept: text/html ;charset=ISO-8859-1 GET /technology /rss Host: www.telegraph.co.uk Accept: text/xml ;charset=UTF-8
        <html> ... </html>
        <rss version=&quot;2.0&quot;> ... </rss>