BT

如何利用碎片时间提升技术认知与能力? 点击获取答案

REST changes in Rails Edge and RADAR

| 作者 Werner Schuster 关注 7 他的粉丝 ,译者 Jason lai 关注 0 他的粉丝 发布于 2007年4月4日. 估计阅读时间: 6 分钟 | QCon上海2018 关注大数据平台技术选型、搭建、系统迁移和优化的经验。

The development version of Ruby on Rails, Rails Edge, was updated with a change to the code that handles REST URLs. From the commit message for this change:"

Dropped the use of ; as a separator of non-crud actions on resources and went back to the vanilla slash. It was a neat idea, but lots of the non-crud actions turned out not to be RPC (as the ; was primarily intended to discourage), but legitimate sub-resources, like /parties/recent, which didn't deserve the uglification of /parties;recent. Further more, the semicolon caused issues with caching and HTTP authentication in Safari. Just Not Worth It [DHH]"

Ryan Daigle gives a succinct overview of what this means:

Whenever you have a custom action route defined in Rails:
map.resources :users, :collection => { :filter => :get }
the resulting route no longer uses a semi-colon (;) to delimit the custom action:
GET /users;filter
and instead will use your standard forward-slash (/):
GET /users/filter

Dave Thomas (PragDave) also reported these news and offered a thorough explanation of the reasons that made the semicolons seem necessary in the first place. After detailing that it's only Web Browsers that require hacks like this, he ponders a solution for the problem:

Put the main application logic into a RESTful server. This is where all the CRUD-style access to resources takes place. Then, write a second proxy server. This is an HTTP filter, sitting between dumb browsers and your core resources. When browser-based users need to interact with your resources, they actually connect to this proxy. It then talks REST to your main server, and interprets the RESTful responses back into a form that's useful on the browser. And this filter doesn't have to be a dumb presentation layer - there's nothing to say that it can't handle additional functionality as well. Things like menus, user preferences, and so on could all sit here.

Since he likens Web Browsers to old 3270 terminals, also referred to as dumb clients, he names this idea "RADAR": RESTful Application talking to Dumb-Ass Recipients.

评价本文

专业度
风格

您好,朋友!

您需要 注册一个InfoQ账号 或者 才能进行评论。在您完成注册后还需要进行一些设置。

获得来自InfoQ的更多体验。

告诉我们您的想法

允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p

当有人回复此评论时请E-mail通知我
社区评论

允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p

当有人回复此评论时请E-mail通知我

允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p

当有人回复此评论时请E-mail通知我

讨论

登陆InfoQ,与你最关心的话题互动。


找回密码....

Follow

关注你最喜爱的话题和作者

快速浏览网站内你所感兴趣话题的精选内容。

Like

内容自由定制

选择想要阅读的主题和喜爱的作者定制自己的新闻源。

Notifications

获取更新

设置通知机制以获取内容更新对您而言是否重要

BT