这种映射url的技术有一个名字



相反,以这种模式构建url:

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

等等。

我相信您正在寻找的是REST:

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

遵守REST约束的Web服务API称为REST

+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+
|                         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

相关内容

最新更新