Successfully reported this slideshow.
Dian Wahyu Aditya [email_address] REST v 2.3
Agenda <ul><li>REST </li></ul><ul><ul><li>Overview
Core Concept
Web Service </li></ul></ul><ul><li>Demo </li></ul><ul><ul><li>Struts2
Spring MVC
Android Client </li></ul></ul>
REST? <ul>Representational State Transfer # Defined by Roy T. Fielding in his doctoral dissertation. <ul>(Co-founder of Ap...
REST? <ul>Representational State Transfer #Use HTTP, URI, and other web standard correctly </ul>Web Used Correctly
REST <ul>CORE CONCEPT </ul>
REST: Core Concept <ul>“ Things are Resources” Resources  can be items of information (a blog entry) or informational desc...
REST: Core Concept <ul>“ Resource Have URIs”   Uniform Resource Identifier  are unique ids for resources. </ul>RESOURCE U R I
REST: Core Concept <ul>“ Resources have Representation” Representations  can have different formats (HTML, XML, JSON). </u...
REST: Core Concept <ul>“ Representations have URLs” Uniform Resource Locators  describe how to get to a representation of ...
REST: Core Concept <ul>“ Client interact via Verbs” </ul>RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL POST GET...
RESTFul <ul>Web Service </ul>
RESTFul Web Service <ul>“ Use HTTP Standard Methods” </ul>Retrieve GET Update PUT Create POST Remove DELETE
RESTFul Web Service <ul>“ Use Standard Methods / Uniform Interface” </ul>Safe GET Idempotent PUT Idempotent DELETE
RESTFul Web Service <ul>“ Use Standard Methods / Uniform Interface” Safe method # There are no side-effects # The requeste...
RESTFul Web Service <ul>“ All About the URIs” http://blog.mervpolis.com/roller/dwx http://blog.mervpolis.com/roller/dwx/ca...
RESTFul Web Service GET /deleteuser?name=Robert HTTP/1.1 DELETE /user/Robert HTTP/1.1
Upcoming SlideShare
Loading in …5
×

RESTFul WebApp Concept

525 views

Published on

Published in: Technology
  • Be the first to comment

RESTFul WebApp Concept

  1. 1. Dian Wahyu Aditya [email_address] REST v 2.3
  2. 2. Agenda <ul><li>REST </li></ul><ul><ul><li>Overview
  3. 3. Core Concept
  4. 4. Web Service </li></ul></ul><ul><li>Demo </li></ul><ul><ul><li>Struts2
  5. 5. Spring MVC
  6. 6. Android Client </li></ul></ul>
  7. 7. REST? <ul>Representational State Transfer # Defined by Roy T. Fielding in his doctoral dissertation. <ul>(Co-founder of Apache HTTP Project) </ul></ul><ul>An Architectural Style </ul>
  8. 8. REST? <ul>Representational State Transfer #Use HTTP, URI, and other web standard correctly </ul>Web Used Correctly
  9. 9. REST <ul>CORE CONCEPT </ul>
  10. 10. REST: Core Concept <ul>“ Things are Resources” Resources can be items of information (a blog entry) or informational descriptions of real things (a blog author) </ul>RESOURCE
  11. 11. REST: Core Concept <ul>“ Resource Have URIs” Uniform Resource Identifier are unique ids for resources. </ul>RESOURCE U R I
  12. 12. REST: Core Concept <ul>“ Resources have Representation” Representations can have different formats (HTML, XML, JSON). </ul>RESOURCE U R I REPRESENTATION REPRESENTATION
  13. 13. REST: Core Concept <ul>“ Representations have URLs” Uniform Resource Locators describe how to get to a representation of a resource, they include protocol, hostname, path and extra information. </ul>RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL
  14. 14. REST: Core Concept <ul>“ Client interact via Verbs” </ul>RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL POST GET PUT DELETE
  15. 15. RESTFul <ul>Web Service </ul>
  16. 16. RESTFul Web Service <ul>“ Use HTTP Standard Methods” </ul>Retrieve GET Update PUT Create POST Remove DELETE
  17. 17. RESTFul Web Service <ul>“ Use Standard Methods / Uniform Interface” </ul>Safe GET Idempotent PUT Idempotent DELETE
  18. 18. RESTFul Web Service <ul>“ 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 </ul>
  19. 19. RESTFul Web Service <ul>“ 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 </ul>Directory Structure-like URIs To the Point Easy to Guess
  20. 20. RESTFul Web Service GET /deleteuser?name=Robert HTTP/1.1 DELETE /user/Robert HTTP/1.1
  21. 21. RESTFul Web Service <ul>“ Uniform Interface” </ul>
  22. 22. RESTFul Web Service <ul>“ Stateless” </ul>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
  23. 23. RESTFul Web Service <ul>“ Stateless” </ul>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
  24. 24. RESTFul Web Service <ul>“ 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 </ul><ul><html> ... </html> </ul><ul><rss version=&quot;2.0&quot;> ... </rss> </ul>

×