这种映射网址的技术有一个名称吗?

时间:2014-04-14 16:02:18

标签: url mapping

而是在此模式下构建网址:

http://www.mysite.com/user/view?name=michele&age=30

写下这样的东西:

http://www.mysite.com/user/view/name/michele/age/30

http://www.mysite.com/user/view,name-michele,age-30

等等。

1 个答案:

答案 0 :(得分:1)

我相信你要找的东西叫做REST:

具象状态转移(REST)是一种体系结构样式,由分布式超媒体系统中应用于组件,连接器和数据元素的一组协调的体系结构约束组成。 REST忽略了组件实现和协议语法的细节,以便专注于组件的角色,与其他组件交互的约束以及对重要数据元素的解释。

符合 REST 约束的Web服务API称为 RESTful。

+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+
|                         Resource                         |                                                          GET                                                          |                                        PUT                                         |                                                             POST                                                              |                     DELETE                     |
+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+
| Collection URI, such as http://example.com/resources     | List the URIs and perhaps other details of the collection's members.                                                  | Replace the entire collection with another collection.                             | Create a new entry in the collection. The new entry's URI is assigned automatically and is usually returned by the operation. | Delete the entire collection.                  |
| Element URI, such as http://example.com/resources/item17 | Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type. | Replace the addressed member of the collection, or if it doesn't exist, create it. | Not generally used. Treat the addressed member as a collection in its own right and create a new entry in it.                 | Delete the addressed member of the collection. |
+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+

更多: http://en.wikipedia.org/wiki/Representational_state_transfer