restful之http讲授

阅读目录:

This specification reserves the method name CONNECT for use with a proxy
that can dynamically switch to being a tunnel (e.g. SSL
tunneling [44]).

  • 一.开张营业介绍
  • 2.Model与View的施用关系(数据上下文DataContext与View展现)
  • 叁.Metadata元数据驱动设计(怎样运用当中层元数据来驱动最后的表现)
  • 四.ASP.NETMVC
    ModelMetadata(ModelMetadata元数据怎么样协助Model与View之间的整合关系)

Methods can also have the property of “idempotence” in that (aside from
error or expiration issues) the side-effects of N > 0 identical
requests is the same as for a single request. The methods GET, HEAD, PUT
and DELETE share this property. Also, the methods OPTIONS and TRACE
SHOULD NOT have side effects, and so are inherently idempotent.

四.ASP.NETMVC ModelMetadata(ModelMetadata元数据如何支撑Model与View之间的组合关系)

未完待续,敬请关心……

 

作者:王清培

出处:http://www.cnblogs.com/wangiqngpei557/

正文版权归小编和新浪共有,迎接转发,但未经小编同意必须保留此段注解,且在篇章页面

If the request passes through a cache and the Request-URI identifies one
or more currently cached entities, those entries SHOULD be treated as
stale. Responses to this method are not cacheable.

二】Model与View的应用关系(数据上下文DataContext与View突显)

在MVC的概念中,Model正确点讲是ViewModel而非DomainModel,ViewModel简称显示Model,首若是将要彰显的数据融入在二个DataContext中,它出自公司应用架构中的Query端的数据源;一般意况下这么的1个ViewModel不会不时转移,都以基于众多的业务场景抽象出来的三个相比Common的数额上下文;

在网站型的系统中,越发电子商务平台,界面包车型客车转换很常见,大约天天都有非常大恐怕变动分界面上的某些展现方式,一样一组数据也许在UI上的显现格局各差异;那里就会产生一个Model与多个View的整合关系,同样1个Promotion(降价)数据上下文,必要在许多注销种类不相同的UI上表现,而各异的UI组斯图加特以由不一样的View的肩负生成;

图1:

图片 1

能够总括出一个数额上下文实体在大许多的事态下都恐怕会被不少View使用,所以ASP.NETMVC
必要有所很强的自定义性,多少个Model能够大四显示出多中Ui而不会为此将ViewModel搞的①团乱;

在意:一个ViewModel数据实体或许十分大,假如为了应景不相同的彰显场景最棒将ViewModel实行切割,拉出承接连串,而不是将享有的ViewModel耦合在一个重特大的ViewModel中,那样会让每2遍的询问都会提到到一些您此番不相干的习性;

Responses to this method are not cacheable, unless the response includes
appropriate Cache-Control or Expires header fields. However, the 303
(See Other) response can be used to direct the user agent to retrieve a
cacheable resource.

一】开篇介绍

那篇小说让我们壹并来读书一下有关Asp.netMvc中的Mode元数据的相关安插和环绕元数据的有个别别样对象模型,他们是何许通过互相和谐来支撑起多个心灵手巧的分界面编制程序接口;

骨子里提到元数据(Metadata)我们在商讨某些应用框架的时候都曾经或多或少的看到过,大概并不曾引起你的专注;其实在好多用到框架中大家都能瞥见Matedata的黑影,它是1个很正确的框架设计形式,俗称:“元数据驱动设计”,它跟近期广大安插观念很周边,如:元编程契约式设计,那么些方式目的皆感到着能很好的调节耦合,发生十分的大的扩充灵活性;元编制程序让我们能依照最后的用户采纳动态的产生运行软件的代码,而契约式设计能让大家将调整权设立在很远的地点,从而比不小粒度的主宰增添性,依照契约设立规则,调控端再在运维时动态的生成出最后必要的平整;

style=”font-size: medium;”>通过对那些情势深切掌握,基本上 style=”font-size: medium;”>能够提炼出两条设计上的纯金规则: style=”font-size: medium;”>1. style=”text-decoration: underline;”>将变化点从编写翻译时迁移到运维时; style=”font-size: medium;”> style=”text-decoration: underline;”>2.将变化点从硬编码迁移到配置化;

这里只是三个归纳的介绍,由于每3个核心细化下来都会比相当的大,都会含有该方向中的多数世界概念、术语和首要的统一筹算观念,所以那边只是3个轻巧易行的牵线,本篇文章会首要介绍一下“元数据驱动设计”编制程序观念和它究竟还好哪个地方,然后在ASP.NETMVC中它起到如何的功效,它又是什么架起通往Model与View的神速桥梁的,让Model与View能够到做壹对N的铺垫关系,在大型站点中ViewModel一般唯有一定的两种,但是View大概会有成千种,如何造成那种中度适配,那就是自定义模板的功力,当然整个都创制在ModelMetadata基础上;

 

3.Metadata元数据驱动设计(如何选拔个中层元数据来驱动最终的行为)

元数据驱动设计方式是累累经文框架设计方式之1,它与契约式设计多少一脉相通的认为;其实框架设计的精神是什么样灵活的采用一些框架设计方式,分歧的语言、平台对情势的使用各差别,可是格局的主导观念一贯不会变,不管你如何设计都必须展现出框架方式的原形才行;

在无尽的框架设计格局中 style=”text-decoration: underline;”>如:契约式设计、元编制程序、元数据驱动设计、管道模型、远程代理方式、提供程序模型;元数据驱动设计情势是利用功效比较高的,因为其复杂度也针锋绝对异常的低所以比较轻便上手;其实在大多存活的.NET框架中,如: style=”text-decoration: underline;”>WCF、ASP.NET、Remoting、Winform中都会看见Metadata的黑影,可是不必然非得要在命名的时候增多Metadata,有那个的时候也会利用Description来代替;

元数据一般作为帮助数据,它是讲述数据的数码,是真的被解析处理的数额;既然是讲述数据的多少,那么就存在它在老大样子上的描述,描述的角度是什么,描述的规模又是是什么;

大家就拿ModelMetadata来讲,在ASP.NETMVC中,Model的利用方向基本上被限制在八个操作集结中,第2:请求的数额绑定,第二:数据绑定期的表明,第3:Model的最后展现;那么ModelMetadata要含有那三个操作集合所须求的全套多少,当然也得以由此切割成三组元数据对象模型,通过持续连串包罗起来;那么ModelMetadata须要描述四个方向上的所急需的数码集结,Model本人就是一中数据,而透过利用ModelMetadata来抽象的描述第二个范畴上的多少,从七个操作群集角度中包涵使用的多寡,也正是说多少个角度,四个层面;如果您的框架必要具有八个范畴,那就必要进一步细化抽象;

图2:

图片 2

标准数据经过一在那之中间的环节转移成元数据,然后提交最后的管理程序去行使;能够很明显的问询到元数据起到的叁个核心成效,它能够很好的将管理程序与业内数据里面解耦,让中间的元数据提供越来越大的灵活性,通过那么些当中层元数据,大家得以很自在的做到对元数据进行配备;

咱俩只要未有中间层元数据,操作程序不管什么样统一筹划都会和专门的职业数量实体有耦合,而且要保险标准数据的纯洁度,不容许三番五次对它使用持续、性子等重度污染性的侵袭,保证完全的POCO(Plain
Old Csharp
Objects)
目的很难,借使未有IDE的编写翻译时帮忙,很难领到出能够在运维时采取的多少;今年大家假若供给修改标准元数据的品种也许涂改操作程序的逻辑都会或多或少的对两端有影响;

假诺运用元数据大家全然能够将表数据对元数据的概念部分迁移到安排文件中去,然后再在元数据提供程序中扩张读取元数据的源流,能够成功将标准数量放在别的地方依然短期的云平台上,对于操作程序来说,大家得以将赢得元数据的接口提取成Service情势,从别的三个地点读取元数据;

那几个各样方案你或者调节永久都不会用到,不过哪个人又能把某部框架的兼具机能都用一面呢,系统须求不一样,都有非常的大恐怕要求那一个扩大点;

(7)    Web服务器闭馆TCP连接

(2) 请求头(Request Header)

(二)    Web浏览器向Web服务器发送请求命令

      伍XX-服务器错误(Server Error)表示服务器不能够达成对请求的拍卖:如 500

GET/sample.jspHTTP/1.1

TRACE allows the client to see what is being received at the other end
of the request chain and use that data for testing or diagnostic
information. The value of the Via header field
(section14.45)
is of particular interest, since it acts as a trace of the request
chain. Use of the Max-Forwards header field allows the client to limit
the length of the request chain, which is useful for testing a chain of
proxies forwarding messages in an infinite loop.

响应头和正文之间也非得用空行分隔。  

   二XX-成功类(Successful),表示用户请求被准确接受,明白和拍卖例如:200
OK

</head>

正如客户端会随同请求发送有关本身的新闻壹致,服务器也会随同应答向用户发送有关它和睦的数据及被呼吁的文书档案。

HTTP/1.1 200 OK

part of Hypertext Transfer Protocol —
HTTP/1.1

RFC 2616 Fielding, et al.

l 响应头(Response Header)

The response to a HEAD request MAY be cacheable in the sense that the
information contained in the response MAY be used to update a previously
cached entity from that resource. If the new field values indicate that
the cached entity differs from the current entity (as would be indicated
by a change in Content-Length, Content-MD5, ETag or Last-Modified), then
the cache MUST treat the cache entry as stale.

HTTP通讯机制是在3遍完整的HTTP通讯进程中,Web浏览器与Web服务器之间将做到下列7个步骤:

 

9.1.2 Idempotent Methods

Web应用最广大的用处之1是电子商务,可以动用Web服务器端程序使人们能够互连网购物,必要建议一点是,缺省事态下,通过Internet发送音信是不安全的,假使某人刚好截获了您发给朋友的一则新闻,他就能开采它,假想在其间有您的信用卡号码,那会有多么不好,幸运的是,许多Web服务器以及Web浏览器都有创制安全连接的力量,那样它们就能够安全的通讯了。

In particular, the convention has been established that the GET and HEAD
methods SHOULD NOT have the significance of taking an action other than
retrieval. These methods ought to be considered “safe”. This allows user
agents to represent other methods, such as POST, PUT and DELETE, in a
special way, so that the user is made aware of the fact that a possibly
unsafe action is being requested.

Content-Type:text/html

9.5 POST

A successful response SHOULD be 200 (OK) if the response includes an
entity describing the status, 202 (Accepted) if the action has not yet
been enacted, or 204 (No Content) if the action has been enacted but the
response does not include an entity.

(3) 请求正文

</body>

The DELETE method requests that the origin server delete the resource
identified by the Request-URI. This method MAY be overridden by human
intervention (or other means) on the origin server. The client cannot be
guaranteed that the operation has been carried out, even if the status
code returned from the origin server indicates that the action has been
completed successfully. However, the server SHOULD NOT indicate success
unless, at the time the response is given, it intends to delete the
resource or move it to an inaccessible location.

If the Request-URI is an asterisk (“*”), the OPTIONS request is
intended to apply to the server in general rather than to a specific
resource. Since a server’s communication options typically depend on the
resource, the “*” request is only useful as a “ping” or “no-op” type of
method; it does nothing beyond allowing the client to test the
capabilities of the server. For example, this can be used to test a
proxy for HTTP/1.1 compliance (or lack thereof).

username=jinqiao&password=1234

9.4 HEAD

(3)    Web浏览器发送请求头消息

     
对于大家Web开垦人士来讲明白HTTP应答码有助于抓牢Web应用程序调节和测试的效能和正确性。

The Max-Forwards request-header field MAY be used to target a specific
proxy in the request chain. When a proxy receives an OPTIONS request on
an absoluteURI for which request forwarding is permitted, the proxy MUST
check for a Max-Forwards field. If the Max-Forwards field-value is zero
(“0”), the proxy MUST NOT forward the message; instead, the proxy SHOULD
respond with its own communication options. If the Max-Forwards
field-value is an integer greater than zero, the proxy MUST decrement
the field-value when it forwards the request. If no Max-Forwards field
is present in the request, then the forwarded request MUST NOT include a
Max-Forwards field.

Accept:image/gif.image/jpeg.*/*

从地点的U昂科威L请求中,很轻巧就能够辩认出表单提交的始末。(?之后的内容)此外是因为GET方法提交的数量是作为UBMWX三L请求的一局地据此提交的数据量不可能太大

If the request is valid, the response SHOULD contain the entire request
message in the entity-body, with a Content-Type of “message/http”.
Responses to this method MUST NOT be cached.

Naturally, it is not possible to ensure that the server does not
generate side-effects as a result of performing a GET request; in fact,
some dynamic resources consider that a feature. The important
distinction here is that the user did not request the side-effects, so
therefore cannot be held accountable for them.

(6)    Web服务器向浏览器发送数据

   Server:Apache Tomcat/5.0.12

</head>

The semantics of the GET method change to a “conditional GET” if the
request message includes an If-Modified-Since, If-Unmodified-Since,
If-Match, If-None-Match, or If-Range header field. A conditional GET
method requests that the entity be transferred only under the
circumstances described by the conditional header field(s). The
conditional GET method is intended to reduce unnecessary network usage
by allowing cached entities to be refreshed without requiring multiple
requests or transferring data already held by the client.

Host:localhost

The Host request-header field
(section 14.23)
MUST accompany all HTTP/1.1 requests.

The actual function performed by the POST method is determined by the
server and is usually dependent on the Request-URI. The posted entity is
subordinate to that URI in the same way that a file is subordinate to a
directory containing it, a news article is subordinate to a newsgroup to
which it is posted, or a record is subordinate to a database.

    

HTTP/1.1 200 OK

   壹XX-音信类(Information),表示接到Web浏览器请求,正在越来越的管理中

Date:Mon,6Oct2003 13:23:42 GMT

l 响应正文

浏览器发送其请求命令之后,还要以头新闻的格局向Web服务器发送一些其他新闻,之后浏览器发送了一空白行来打招呼服务器,它曾经终止了该头消息的出殡和埋葬。

UQX56L完整地内定了要访问的互联网财富,日常借使付给相对于服务器的根目录的相持目录就能够,由此老是以“/”开首,最后,协议版本申明了通讯进度中行使HTTP的版本。

The action performed by the POST method might not result in a resource
that can be identified by a URI. In this case, either 200 (OK) or 204
(No Content) is the appropriate response status, depending on whether or
not the response includes an entity that describes the result.

例如:GET/sample/hello.jsp HTTP/1.1

Connection:keep-alive

GET方法是暗许的HTTP请求方法,大家一般用GET方法来交付表单数据,但是用GET方法提交的表单数据只透过了简便易行的编码,同时它将用作U卡宴L的1部分向Web服务器发送,由此,假设应用GET方法来交给表单数据就存在着安全隐患上。举例

9.6 PUT

9.7 DELETE

POST方法是GET方法的三个代替格局,它至关心保护即使向Web服务器交由表单数据,尤其是多量的数量。POST方法战胜了GET方法的某个欠缺。通过POST方法提交表单数据时,数据不是当做URubiconL请求的一有的而是作为专门的职业数据传送给Web服务器,这就克服了GET方法中的消息不可能保密和数据量太小的缺点。由此,出于安全的设想以及对用户隐衷的重视,平日表单提交时选拔POST方法。

 

l   请求头(Request Header)

当浏览器向Web服务器发出请求时,它向服务器传递了一个数据块,也正是伸手音信,HTTP请求音信由3片段构成:

The semantics of the GET method change to a “partial GET” if the request
message includes a Range header field. A partial GET requests that only
part of the entity be transferred, as described in
section 14.35.
The partial GET method is intended to reduce unnecessary network usage
by allowing partially-retrieved entities to be completed without
transferring data already held by the client.

l         GET方法

其间, HEAD GET POST OPTIONS PROPFIND是和读取相关的方法,MKCOL PUT
DELETE LOCK UNLOCK COPY MOVE PROPPATCH是和改造有关的方法

The set of common methods for HTTP/1.1 is defined below. Although this
set can be expanded, additional methods cannot be assumed to share the
same semantics for separately extended clients and servers.

应对的率先有的是说道的版本号和应答状态码

Hello HTTP!

</html>
商讨状态代码描述HTTP响应的首先行类似于HTTP请求的率先行,它意味着通讯所用的磋商是HTTP一.一服务器已经成功的拍卖了客户端发出的伸手(200意味着成功):

l   请求方法U福特ExplorerI协议/版本

l         POST方法

Web服务器向浏览器发送头消息后,它会发送1个空白行来代表头新闻的发送到此为截至,接着,它就以Content-Type应答头消息所讲述的格式发送用户所请求的实在多少

body is not defined by this specification, but might be defined by
future extensions to HTTP. Content negotiation MAY be used to select the
appropriate response format. If no response body is included, the
response MUST include a Content-Length field with a field-value of “0”.

Accept-Encoding:gzip,deflate.

Accept-Language:zh-cn

9.1 Safe and Idempotent Methods

Accept:image/gif.image/jpeg,*/*

   HTTP应答码也称之为状态码,它反映了Web服务器管理HTTP请求状态。HTTP应答码由四人数字组合,当中第4位数字定义了应答码的种类:

l        HTTP应答码

借使创设了TCP连接,Web浏览器就会向Web服务器发送请求命令

HTTP应答与HTTP请求相似,HTTP响应也由三个部分构成,分别是:

Unless otherwise specified for a particular entity-header, the
entity-headers in the PUT request SHOULD be applied to the resource
created or modified by the PUT.

上边是三个HTTP响应的例证:

Hello HTTP!

Connection:Keep-Alive

apache第22中学,可利用Limit,LimitExcept进行访问调控的方法包括:GETPOSTPUTDELETECONNECT,OPTIONSPATCHPROPFINDPROPPATCHMKCOLCOPYMOVELOCK,
和 UNLOCK.

      肆XX-客户端错误(Client Error),表示客户端提交的乞请有荒唐 举个例子:40四NOT

在HTTP职业起先此前,Web浏览器首先要通过互连网与Web服务器建立连接,该连接是经过TCP来成功的,该协议与IP协议员联盟手创设Internet,即盛名的TCP/IP协议族,由此Internet又被称作是TCP/IP网络。HTTP是比TCP越来越高档次的应用层协议,根据规则,唯有低层协议建立之后才干,技巧术展览开更层协议的连日,由此,首先要两手空空TCP连接,一般TCP连接的端口号是80

PUT requests MUST obey the message transmission requirements set out in
section 8.2.

请求头包罗众多关于的客户端情形和请求正文的有用信息。比如,请求头可以注明浏览器所用的语言,请求正文的长短等。

POST requests MUST obey the message transmission requirements set out in
section 8.2.

Content-Length:112

  <html>
<head>

origin server or the first proxy or gateway to receive a Max-Forwards
value of zero (0) in the request (see section 14.31). A TRACE request
MUST NOT include an entity.

请求头和呼吁正文之间是一个空行,这些可以照旧不可能关键,它意味着请求头已经收尾,接下去的是伸手正文。请求正文中得以包含客户提交的询问字符串消息:

TCP连接在出殡和埋葬后将依然保持开荒状态,于是,浏览器能够继续透过平等的连年发送请求。保持接二连三节省了为各样请求建立新连接所需的时间,还节约了互连网带宽。

Http://127.0.0.1/login.jsp?Name=zhangshi&Age=30&Submit=%cc%E+%BD%BB

See
section 15.1.3 for
security considerations.

A single resource MAY be identified by many different URIs. For example,
an article might have a URI for identifying “the current version” which
is separate from the URI identifying each particular version. In this
case, a PUT request on a general URI might result in several other URIs
being defined by the origin server.

透过Internet提供安全连接最广泛的行业内部是套套接层(Secure Sockets
layer,SSl)协议。SSL协议是贰个应用层协议(和HTTP一样),用于安全格局在Web上沟通数据,SSL使用公开密钥编码系统。从实质讲,那意味专门的学业中每一方都具备3个公然的和三个个体的密钥。当一方选用另一方公开密钥进行编码时,只有全数非凡密钥的人才具对其解码。简单的讲,公开密钥编码提供了一种用于在双方之间调换数据的崇左方法,SSL连接建立今后,客户和服务器都换到公开密钥,并在开展业务联系以前开始展览说明,一旦双方的密钥都因而验证,就足以安枕无忧地交流数据。

If the OPTIONS request includes an entity-body (as indicated by the
presence of Content-Length or Transfer-Encoding), then the media type
MUST be indicated by a Content-Type field. Although this specification
does not define any use for such a body, future extensions to HTTP might
use the OPTIONS body to make more detailed queries on the server. A
server that does not support such an extension MAY discard the request
body.

依靠HTTP标准,HTTP请求能够动用多样呼吁方法。比如:HTTP1.一支撑七种请求方法:GET、POST、HEAD、OPTIONS、PUT、DELETE和TARubiconCE。在Internet应用中,最常用的方式是GET和POST。

The POST method is used to request that the origin server accept the
entity enclosed in the request as a new subordinate of the resource
identified by the Request-URI in the Request-Line. POST is designed to
allow a uniform method to cover the following functions:

请求的率先行是“方法U奥德赛L议/版本”:GET/sample.jsp HTTP/一.一

HTTP请求方法自个儿那边只谈谈GET方法与POST方法

  • GET
    通过请求UEscortI获得财富
  • POST,
    用以加多新的内容
  • PUT
    用来修改有个别内容
  • DELETE,
    除去有个别内容
  • CONNECT,
    用以代理举办传输,如采纳SSL
  • OPTIONS
    叩问能够试行什么样方法
  • PATCH,
    某些文档更动
  • PROPFIND, (wedav)
    翻开属性
  • PROPPATCH, (wedav)
    设置属性
  • MKCOL, (wedav)
    始建集结(文件夹)
  • COPY, (wedav)
    拷贝
  • MOVE, (wedav)
    移动
  • LOCK, (wedav)
    加锁
  • UNLOCK (wedav)
    解锁
  • TRACE
    用于远程会诊服务器
  • HEAD
    看似于GET,
    可是不回来body音讯,用于检核查象是还是不是留存,以及得到目的的元数据

A 200 response SHOULD include any header fields that indicate optional
features implemented by the server and applicable to that resource
(e.g., Allow), possibly including extensions not defined by this
specification. The response body, if any, SHOULD also include
information about the communication options. The format for such a

Accept-Language:zh-cn

See
section 15.1.3 for
security considerations when used for forms.

(肆)    Web服务器应对

以上代码中“GET”代表呼吁方法,“/sample.jsp”表示U库罗德I,“HTTP/1.1表示商讨和商讨的版本。

上边是2个HTTP请求的例证:

Connection:Keep-Alive

9.2 OPTIONS

 

 

If the request passes through a cache and the Request-URI identifies one
or more currently cached entities, those entries SHOULD be treated as
stale. Responses to this method are not cacheable.

(一)       请求方法U福睿斯I协议/版本

HTTP/1.1 200 OK
响应头(Response
Header)响应头也和请求头同样蕴涵众多得力的音信,举例服务器类型、日期时间、内容类型和长度等:

<title>HTTP响应示例<title>

<body>

username=jinqiao&password=1234

The HEAD method is identical to GET except that the server MUST NOT
return a message-body in the response. The metainformation contained in
the HTTP headers in response to a HEAD request SHOULD be identical to
the information sent in response to a GET request. This method can be
used for obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This method is
often used for testing hypertext links for validity, accessibility, and
recent modification.

However, it is possible that a sequence of several requests is non-
idempotent, even if all of the methods executed in that sequence are
idempotent. (A sequence is idempotent if a single execution of the
entire sequence always yields a result that is not changed by a
reexecution of all, or part, of that sequence.) For example, a sequence
is non-idempotent if its result depends on a value that is later
modified in the same sequence.

一般景况下,壹旦Web服务器向浏览器发送了请求数据,它就要关门TCP连接,然后假使浏览器照旧服务器在其头新闻到场了那行代码

Date:Mon,6Oct2003 13:13:33 GMT

Content-Length:112

Responses to this method are not cacheable.

     
三XX-重定向类(Redirection),表示请求未遂,客户必须接纳进一步的动作。

9.9 CONNECT

</html>

l 磋商状态版本代码描述

<html>
<head>

The PUT method requests that the enclosed entity be stored under the
supplied Request-URI. If the Request-URI refers to an already existing
resource, the enclosed entity SHOULD be considered as a modified version
of the one residing on the origin server. If the Request-URI does not
point to an existing resource, and that URI is capable of being defined
as a new resource by the requesting user agent, the origin server can
create the resource with that URI. If a new resource is created, the
origin server MUST inform the user agent via the 201 (Created) response.
If an existing resource is modified, either the 200 (OK) or 204 (No
Content) response codes SHOULD be sent to indicate successful completion
of the request. If the resource could not be created or modified with
the Request-URI, an appropriate error response SHOULD be given that
reflects the nature of the problem. The recipient of the entity MUST NOT
ignore any Content-* (e.g. Content-Range) headers that it does not
understand or implement and MUST return a 501 (Not Implemented) response
in such cases.

HTTP请求格式

Accept-Encoding:gzip,deflate

If the Request-URI is not an asterisk, the OPTIONS request applies only
to the options that are available when communicating with that resource.

The OPTIONS method represents a request for information about the
communication options available on the request/response chain identified
by the Request-URI. This method allows the client to determine the
options and/or requirements associated with a resource, or the
capabilities of a server, without implying a resource action or
initiating a resource retrieval.

                                   
Found,意味着请求中所引用的文书档案不设有。

9.1.1 Safe Methods

Server:Apache Tomcat/5.0.12

HTTP使用内容类型,是指Web服务器向Web浏览器再次回到的文件都有与之有关的花色。全部这几个品种在MIME Internet邮件协议上模型化,即Web服务器告诉Web浏览器该文件所持有的体系,是HTML文书档案、GIF格式图像、声音文件仍旧独立的应用程序。大多数Web浏览器都怀有1种种的可配置的帮助应用程序,它们告诉浏览器应该怎么样管理Web服务器发送过来的各个内容类型。

HTTP/1.1 does not define how a PUT method affects the state of an origin
server.

User-Agent:Mozila/4.0(compatible;MSIE5.01;Window NT5.0)

客户机向服务器发出请求后,服务器会客户机回送应答,

User-Agent:Mozila/4.0(compatible:MSIE5.01:Windows NT5.0)

The response to a GET request is cacheable if and only if it meets the
requirements for HTTP caching described in section 13.

If a resource has been created on the origin server, the response SHOULD
be 201 (Created) and contain an entity which describes the status of the
request and refers to the new resource, and a Location header (see
section 14.30).

The TRACE method is used to invoke a remote, application-layer loop-
back of the request message. The final recipient of the request SHOULD
reflect the message received back to the client as the entity-body of a
200 (OK) response. The final recipient is either the

HTTP(HyperText Transfer
Protocol)是一套Computer通过网络开展通讯的条条框框。Computer专家设计出HTTP,使HTTP客户(如Web浏览器)能够从HTTP服务器(Web服务器)请求消息和服务,HTTP目前磋商的本子是一.1.HTTP是壹种无状态的情商,无状态是指Web浏览器和Web服务器之间不供给树立持久的连天,那代表当3个客户端向劳动器端发出请求,然后Web服务器重临响应(response),连接就被关门了,在劳动器端不保留连接的关于新闻.HTTP坚守请求(Request)/应答(Response)模型。Web浏览器向Web服务器发送请求,Web服务器管理请求并回到适当的答应。全部HTTP连接都被协会成1套请求和回应。

- Annotation of existing resources;

- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;

- Providing a block of data, such as the result of submitting a form, to a data-handling process;

- Extending a database through an append operation.

Last-Moified:Mon,6 Oct 2003 13:23:42 GMT

Host:localhost

平安连接

<body>

9.3 GET

在上述的例证的HTTP请求中,请求的正文唯有1行内容。当然,在其实使用中,HTTP请求正文可以分包更多的剧情。

(1)    建立TCP连接

9.8 TRACE

Implementors should be aware that the software represents the user in
their interactions over the Internet, and should be careful to allow the
user to be aware of any actions they might take which may have an
unexpected significance to themselves or others.

</body>

9 Method Definitions

l   请求正文

(伍)    Web服务器发送应答头音讯

The GET method means retrieve whatever information (in the form of an
entity) is identified by the Request-URI. If the Request-URI refers to a
data-producing process, it is the produced data which shall be returned
as the entity in the response and not the source text of the process,
unless that text happens to be the output of the process.

 响应正文响应正文正是服务器再次来到的HTML页面:

  从编制程序的角度来讲,借使用户通过GET方法提交数据,则数据存放在QUERubiconY_ST冠道ING境遇变量中,而POST方法提交的多少则能够从标准输入流中获取。

<title>HTTP响应示例<title>

The fundamental difference between the POST and PUT requests is
reflected in the different meaning of the Request-URI. The URI in a POST
request identifies the resource that will handle the enclosed entity.
That resource might be a data-accepting process, a gateway to some other
protocol, or a separate entity that accepts annotations. In contrast,
the URI in a PUT request identifies the entity enclosed with the request
— the user agent knows what URI is intended and the server MUST NOT
attempt to apply the request to some other resource. If the server
desires that the request be applied to a different URI,

it MUST send a 301 (Moved Permanently) response; the user agent MAY then
make its own decision regarding whether or not to redirect the request.

A sequence that never has side effects is idempotent, by definition
(provided that no concurrent operations are being executed on the same
set of resources).

Leave a Comment.