??xml version="1.0" encoding="utf-8" standalone="yes"?>
Architectural Styles and the Design of Network-based Software Architectures by Roy Thomas Fielding
Doctor of Philosophy in Information and Computer Science
University of California, Irvine, 2000
Professor Richard N. Taylor, Chair
The World Wide Web has succeeded in large part because its software architecture has
been designed to meet the needs of an Internet-scale distributed hypermedia system. The
Web has been iteratively developed over the past ten years through a series of
modifications to the standards that define its architecture. In order to identify those aspects
of the Web that needed improvement and avoid undesirable modifications, a model for the
modern Web architecture was needed to guide its design, definition, and deployment.
Software architecture research investigates methods for determining how best to
partition a system, how components identify and communicate with each other, how
information is communicated, how elements of a system can evolve independently, and
how all of the above can be described using formal and informal notations. My work is
motivated by the desire to understand and evaluate the architectural design of networkbased
application software through principled use of architectural constraints, thereby
obtaining the functional, performance, and social properties desired of an architecture. An
architectural style is a named, coordinated set of architectural constraints.
This dissertation defines a framework for understanding software architecture via
architectural styles and demonstrates how styles can be used to guide the architectural
design of network-based application software. A survey of architectural styles for
network-based applications is used to classify styles according to the architectural
properties they induce on an architecture for distributed hypermedia. I then introduce the
Representational State Transfer (REST) architectural style and describe how REST has
been used to guide the design and development of the architecture for the modern Web.
REST emphasizes scalability of component interactions, generality of interfaces,
independent deployment of components, and intermediary components to reduce
interaction latency, enforce security, and encapsulate legacy systems. I describe the
software engineering principles guiding REST and the interaction constraints chosen to
retain those principles, contrasting them to the constraints of other architectural styles.
Finally, I describe the lessons learned from applying REST to the design of the Hypertext
Transfer Protocol and Uniform Resource Identifier standards, and from their subsequent
deployment in Web client and server software.
Roy Thomas Fielding博士论文英文版本 http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
]]>
<request line>
<headers>
<blank line>
[<request-body>]
?/span>HTTPh中,W一行必L一个请求行Q?/span>request lineQ,用来说明hcd、要讉K?nobr oncontextmenu="return false;" onmousemove="kwM(11);" id="key6" onmouseover="kwE(event,11, this);" style="color: #6600ff; border-bottom: #6600ff 1px dotted; background-color: transparent; text-decoration: underline" onclick="return kwC();" onmouseout="kwL(event, this);" target="_blank">资源以及使用?/span>HTTP版本。紧接着是一个首部(headerQ小节,用来说明服务器要使用的附加信息。在首部之后是一个空行,再此之后可以dL的其他数?/span>[UCZ体(bodyQ?/span>]?/span>
HTTP 定义了与服务器交互的不同Ҏ(gu)Q最基本的方法是 GET ?/span> POSTQ?/span>Ajax
GET?/span>POSTҎ(gu)有以下区别:
Q?Q?span style="font: 7pt 'Times New Roman'"> 在客LQ?/span>Get方式在通过URL提交数据Q数?/span>?/span>URL中可以看刎ͼPOST方式Q数据放|在HTML HEADER内提交?/span>
Q?Q?span style="font: 7pt 'Times New Roman'"> GET方式提交的数据最多只能有1024字节Q?/span>POST则没有此限制?/span>
Q?Q?span style="font: 7pt 'Times New Roman'"> 安全性问题。正如在Q?/span>1Q中提到Q?/span> Get 的时候,参数会显C在地址栏上Q?/span> Post 不会。所以,如果q些数据是中文数据而且是非敏感数据Q那么?/span> getQ如果用戯入的数据不是中文字符而且包含敏感数据Q那么还是?/span> post为好?/span>
Q?Q?span style="font: 7pt 'Times New Roman'"> 安全的和q等的。所谓安全的意味着该操作用于获取信息而非修改信息。幂{的意味着对同一 URL 的多个请求应该返回同Ll果。完整的定义q不像看h那样严格。换句话_GET h一般不应生副作用。从Ҏ(gu)上讲Q其目标是当用户打开一个链接时Q她可以信从自w的角度来看没有改变资源。比如,新闻站点的头版不断更新。虽然第二次h会返回不同的一Ҏ(gu)闻,该操作仍然被认ؓ是安全的和幂{的Q因为它Lq回当前的新闅R反之亦然?/span>POST h׃那么L了?/span>POST 表示可能改变服务器上的资源的h。仍然以新闻站点ZQ读者对文章的注解应该通过 POST h实现Q因为在注解提交之后站点已经不同了(比方说文章下面出C条注解)?br /> http://www.cnblogs.com/stu-acer/archive/2006/08/28/488802.html
GET?/span>POSTҎ(gu)实例Q?br />
GET /books/?name=Professional%20Ajax HTTP/1.1 Host: www.wrox.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1 Connection: Keep-Alive POST / Host: www.wrox.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20050225 Firefox/ Content-Type: application/x-www-form-urlencoded Content-Length: 40 Connection: Keep-Alive name=Professional%20Ajax&publisher=Wiley
GET实例
POST实例
Q此处空一行)
Q?/span>1Q?/span>get是从服务器上获取数据Q?/span>post是向服务器传送数据?/span>
Q?/span>2Q对于表单的提交方式Q?/span>在服务器端只能用Request.QueryString来获?/span>Get方式提交来的数据Q用Post方式提交的数据只能用Request.Form来获取?/span>
Q?/span>3Q一般来_量避免使用Get方式提交表单Q因为有可能会导致安全问题。比如说在登陆表单中?/span>Get方式Q用戯入的用户名和密码在地址栏中暴露无遗。但是在分页E序中,?/span>Get方式比?/span>Post好?/span>
<status line>
<headers>
<blank line>
[<response-body>]
在响应中唯一真正?span style="color: red">区别在于W一行中用状?nobr oncontextmenu="return false;" onmousemove="kwM(1);" id="key1" onmouseover="kwE(event,1, this);" style="color: #6600ff; border-bottom: #6600ff 1px dotted; background-color: transparent; text-decoration: underline" onclick="return kwC();" onmouseout="kwL(event, this);" target="_blank">信息代替了请求信息?span style="color: red">状态行Q?/span>status lineQ通过提供一个状态码来说明所h的资源情c?/span>
HTTP响应实例Q?/span>
HTTP/1.1 200 OK Date: Sat, 31 Dec 2005 23:59:59 GMT Content-Type: text/html;charset=ISO-8859-1 Content-Length: 122 Q?/span>htmlQ?/span> Q?/span>headQ?/span> Q?/span>titleQ?/span>Wrox HomepageQ?/span>/titleQ?/span> Q?/span>/headQ?/span> Q?/span>bodyQ?/span> Q?/span>!-- body goes here --Q?/span> Q?/span>/bodyQ?/span> Q?/span>/htmlQ?/span>
?/span>200 (OK): 扑ֈ了该资源Qƈ且一切正常?/span>
?/span>304 (NOT MODIFIED): 该资源在上次h之后没有M修改。这通常用于览器的~存机制?/span>
?/span>401 (UNAUTHORIZED):
?/span>403 (FORBIDDEN): 客户端未能获得授权。这通常是在401之后输入了不正确的用户名或密码?/span>
?/span>404 (NOT FOUND): 在指定的位置不存在所甌?nobr oncontextmenu="return false;" onmousemove="kwM(7);" id="key5" onmouseover="kwE(event,7, this);" style="color: #6600ff; border-bottom: 0px dotted; background-color: transparent; text-decoration: underline" onclick="return kwC();" onmouseout="kwL(event, this);" target="_blank">资源?/span>