If someone said their web app was RESTful, what types of features would you assume it contained?
I was reading about a blog application that was described as RESTfu开发者_Go百科l.
If someone told you their web application was RESTful, what types of features would you assume it contained, to differentiate it from a non-RESTful web application?
When talking about a web site rather than a web service (which i assume you are), 'RESTful' is a fairly weak term, because the web is a fundamentally RESTful system anyway. Points which distinguish a truly RESTful website from others include:
Use HTTP authentication on every request for access control; there should be no login page
Expose only bookmarkable URLs that look the same (if accessible) to all comers; there should be no
/myaccount
, only/account/Chuck
Not keep any user state in hidden session variables, but only in the URL; if you change your friends page view from summaries to titles only, there should be a change in the URL, and subequently visiting either of those URLs should show the page in the corresponding way
Other than that, it's mostly a question of being web-like in the way that all sites are: all pages can be reached by traversing links (including submitting forms) from other pages (you never have to munge a URL by hand or know a magic secret URL), responses contain metadata describing what they are (the content-type in the HTTP response), etc.
Nothing much to do with features, just how they're accessed.
The basic difference is that SOAP is based on verbs, so you'd have functions such as AddRecord
. REST is based on nouns, so you'd just PUT a version of the document that has an additional record.
精彩评论