2011年4月19日 星期二

初探RESTful-I

最近泰哥要我研究RESTful Service in Codeigniter,雖然tutorial看的懂,能夠寫基本的code,但對tutorial中所提到的REST/RESTful卻還是有點模糊,上網找了些資料來看,找到有一篇還不錯REST and RESTful web service,是石頭大寫的,對RESTful的說明簡單易懂.
後來找到了一本書"RESTful Java Web Services-Master core REST concepts and create RESTful web services in Java",當中也有對REST/REST-like/RESTful做說明.

What is REST?
The term REST comes from Roy Fielding's PhD dissertation, published in 2000, and it stands for REpresentational State Transfer. REST by itself is not an architecture;REST is a set of constraints that, when applied to the design of a system, creates a software architectural style.If we implement all the REST guidelines outlined in Fielding's work, we end up with a system that has specific roles for data, components, hyperlinks, communication protocols, and data consumers.

What is RESTful?
They only define how data is transferred between components and what are the benefits of following the guidelines.
  • It must be a client-server system
  • It has to be stateless—there should be no need for the service to keep users' sessions; in other words, each request should be independent of others
  • It has to support a caching system—the network infrastructure should support cache at different levels
  • It has to be uniformly accessible—each resource must have a unique address and a valid point of access
  • It has to be layered—it must support scalability
  • It should provide code on demand—although this is an optional constraint, applications can be extendable at runtime by allowing the downloading of code on demand, for example, Java Applets
Reference:
REST and RESTful web service
Working with RESTful Services in CodeIgniter

沒有留言: