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 WebApp Concept

  • 1.
    Dian Wahyu Aditya[email_address] REST v 2.3
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
    REST? Representational StateTransfer # Defined by Roy T. Fielding in his doctoral dissertation. (Co-founder of Apache HTTP Project) An Architectural Style
  • 8.
    REST? Representational StateTransfer #Use HTTP, URI, and other web standard correctly Web Used Correctly
  • 9.
  • 10.
    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
  • 11.
    REST: Core Concept“ Resource Have URIs” Uniform Resource Identifier are unique ids for resources. RESOURCE U R I
  • 12.
    REST: Core Concept“ Resources have Representation” Representations can have different formats (HTML, XML, JSON). RESOURCE U R I REPRESENTATION REPRESENTATION
  • 13.
    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
  • 14.
    REST: Core Concept“ Client interact via Verbs” RESOURCE U R I REPRESENTATION REPRESENTATION URL URL URL POST GET PUT DELETE
  • 15.
  • 16.
    RESTFul Web Service“ Use HTTP Standard Methods” Retrieve GET Update PUT Create POST Remove DELETE
  • 17.
    RESTFul Web Service“ Use Standard Methods / Uniform Interface” Safe GET Idempotent PUT Idempotent DELETE
  • 18.
    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
  • 19.
    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
  • 20.
    RESTFul Web ServiceGET /deleteuser?name=Robert HTTP/1.1 DELETE /user/Robert HTTP/1.1