或许你在一些国外的Blog上看到过REST这个词,下面用一个很简单的例子说明一下REST的定义.
以浏览网页为例, 当你要查看某个网页的时候, 你需要在浏览器上输入该网页的URL. 当你发出对idior.cnblogs.com这个资源的请求后, 一个该资源的表现形式(Representation)将返回给你, 也就是idior.cnblogs.com相应的html文件. 这时候你就进入一个状态(State), 也就是查看我的blog首页的状态, 当你在我的blog中点击了某个链接http://idior.cnblogs.com/category/46628.html, 你又对另一个资源发出了请求, 随后得到一个Representation, 因此你转为(Transfer)另一个状态(State).
Client application transfers state with each resource representation. This is REST.
REST is not a standard. You will not see the W3C putting out a REST specification. You will not see IBM or Ms selling a REST developer's toolkit. Why? Because REST is just an architectural style. You can't bottle up that style. You can only understand it, and design your Web service in that style.
While REST is not a standard, it does prescribe the use of standards:
--- HTTP
--- URL
--- XML/HTML/GIF/JPEG/etc (Resource Representations)
--- text/xml, text/html, image/gif, image/jpeg, etc (Resource Types, MIME Types)