REST Architectural Style: A Detail Explain

834 views

Published on

The idea of this talk is to explain the architectural design concepts behind REST APIS and its roles in modern web APIs.This is a presentation at Barcamp Saigon 2012.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
834
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

REST Architectural Style: A Detail Explain

  1. 1. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion REST Architectural Style: A Detail Explain Cao Duc Nguyen nguyen.cao-duc@hp.com Software Designer April 26, 2012
  2. 2. Introduction REST Fundamentals Java Open Source RESTful Web Services Outline 1 Introduction Web APIs 2 REST Fundamentals HTTP REST 3 Java Open Source RESTful Web Services Specification Implementation 4 Conclusion Discussion Final word Conclusion
  3. 3. Introduction REST Fundamentals Java Open Source RESTful Web Services Web APIs The Importance of APIs in Web Development Conclusion
  4. 4. Introduction REST Fundamentals Java Open Source RESTful Web Services Web APIs APIs Timeline on ProgrammableWeb Conclusion
  5. 5. Introduction REST Fundamentals Java Open Source RESTful Web Services Web APIs APIs Timeline on ProgrammableWeb in more details Conclusion
  6. 6. Introduction REST Fundamentals Web APIs Featured APIs & Mashups Java Open Source RESTful Web Services Conclusion
  7. 7. Introduction REST Fundamentals Web APIs APIs protocols & styles Java Open Source RESTful Web Services Conclusion
  8. 8. Introduction REST Fundamentals HTTP REST is an architectural style Gorthic Architectural Style Java Open Source RESTful Web Services Conclusion
  9. 9. Introduction REST Fundamentals Java Open Source RESTful Web Services HTTP REST v.s HTTP Gorthic architectural style REST HTTP Conclusion
  10. 10. Introduction REST Fundamentals HTTP Client/Server Model Java Open Source RESTful Web Services Conclusion
  11. 11. Introduction REST Fundamentals HTTP HTTP is resource-centric Java Open Source RESTful Web Services Conclusion
  12. 12. Introduction REST Fundamentals Java Open Source RESTful Web Services HTTP Resource Identifier, Methods & Representations Conclusion
  13. 13. Introduction REST Fundamentals Java Open Source RESTful Web Services HTTP Hypermedia: Association & Composition Conclusion
  14. 14. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion HTTP HTTP Methods in more details GET Safe, Idempotent, Cacheable PUT Idempotent DELETE Idempotent HEAD Safe, Idempotent OPTIONS Safe, Idempotent POST Safe The client did not request any side-effects on server other than data retrieval. Idempotent Any side-effects on the server of several identical idempotent methods are the same as the side-effects of one single method. Cacheable Explain in more details later. . .
  15. 15. Introduction REST Fundamentals Java Open Source RESTful Web Services HTTP Intermediaries - Cache A new request for a cached resource can be returned immediately by intermediary caches. Conclusion
  16. 16. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion HTTP Intermediaries - Proxy & Gateway Proxy an intermediary selected by a client, to provide interfaces to services like data translation, performance enhancement, or security protection. Gateway an intermediary imposed by the network or origin server to provide an interface encapsulation of other services, for data translation, performance enhancement, or security enforcement.
  17. 17. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion HTTP Stateless HTTP Requests are stateless, which means each request is independent from the others.
  18. 18. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion HTTP Stateless HTTP Requests are stateless, which means each request is independent from the others. intermediaries only need to work on a single interaction without knowing the entire topology
  19. 19. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion REST REST Architectural Style REpresentational State Transfer The representation returned by the server places or transfers the client from state to state. REST Architectural Style . . . a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems. Roy T. Fielding
  20. 20. Introduction REST Fundamentals REST REST Architectural Constraints Java Open Source RESTful Web Services Conclusion
  21. 21. Introduction REST Fundamentals REST REST Architectural Elements Java Open Source RESTful Web Services Conclusion
  22. 22. Introduction REST Fundamentals REST RESTful v.s SOAP Java Open Source RESTful Web Services Conclusion
  23. 23. Introduction REST Fundamentals Java Open Source RESTful Web Services Specification JAX-RS: The Java™API for RESTful Web Services Conclusion
  24. 24. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion Specification JAX-RS Hello Example import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @Path("/hello/{username}") public class Hello { private String name="no-one"; @GET @Produces("text/plain") public String hello(@PathParam("username") String userName) { userName = userName==null?name:userName; return " Hello, "+userName; }
  25. 25. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion Specification JAX-RS Hello Example @POST @Consumes("text/plain") public String hello(@FormParam("username") String userName) { name = userName==null?name:userName; return " Hello, "+userName; } }
  26. 26. Introduction REST Fundamentals Java Open Source RESTful Web Services Conclusion Implementation Open Sources RESTful Web Service Implementation of JAX-RS Jersey - Sun reference implementation RESTEasy - JBoss Restlet
  27. 27. Introduction REST Fundamentals Java Open Source RESTful Web Services Discussion REST Motivation Scalability Perfomance Reduce Payload & Latency Dynamic Component Connectors Conclusion
  28. 28. Introduction REST Fundamentals Discussion REST v.s the rest SOA ? Servlet & JSP ? Javascript ? Java Open Source RESTful Web Services Conclusion
  29. 29. Introduction REST Fundamentals Final word Web APIs Worldwide Java Open Source RESTful Web Services Conclusion
  30. 30. Introduction REST Fundamentals Final word Web APIs Featured Regions Java Open Source RESTful Web Services Conclusion
  31. 31. Introduction REST Fundamentals Final word Web APIs Vietnam Java Open Source RESTful Web Services Conclusion
  32. 32. Introduction REST Fundamentals Java Open Source RESTful Web Services Final word THANK YOU *-* Conclusion

×