【正文】
rv: )接受:image/gif,image/jpeg,im。 Win 9x 。下面是一個(gè)例子,一個(gè)有效的HTTP請求消息:GET/ HTTP/Host:用戶代理: Mozilla/ (Windows。標(biāo)題要求提供額外的信息可以使用服務(wù)器來處理請求。顧名思義,GET請求用于從服務(wù)器檢索資源。 HTTP請求消息由三部份組成:一個(gè)請求行,請求標(biāo)頭,請求體。例如,當(dāng)請求已被交付給服務(wù)器,位置已經(jīng)定確,只有資源標(biāo)識符是很重要的。因此,我只有當(dāng)URL以開頭時(shí)才使用的term URL(或,為HTTP加密連線),其次是服務(wù)器名稱,并可能有一個(gè)端口號,如以前的例子。該條款的URN和URL常常被互換,不幸的是,他們有不同的定義略有不同的規(guī)格。另一種類型的URL是一個(gè)統(tǒng)一資源名稱(URN),這是一個(gè)全局唯一標(biāo)識符,無論在什么地方都有效的資源的位置。網(wǎng)址實(shí)際上是一個(gè)專業(yè)化的統(tǒng)一資源標(biāo)識符(URL,所界定的符合RFC2396規(guī)格)。例如::8080/這一請求被發(fā)送到一臺服務(wù)器,使用端口8080而不是80。端口號80是標(biāo)準(zhǔn)端口,用于HTTP請求。其次是服務(wù)器的名稱。發(fā)送請求后,瀏覽器需要知道與哪些服務(wù)器交換數(shù)據(jù),并要求得到資源。s been updated since the last time it was requested. The ContentType header tells the browser what type of response data the body contains and the ContentLength header how large it is. The other headers are selfexplanatory. A blank line separates the headers from the message body. Here the body is a simple HTML pagehtmlbodyh1Hello World!/h1/body/htmlOf course, the body can contain a more plex HTML page or any other type of content. For example, the request may return an HTML page with img elements. When the browser reads the first response and finds the img elements, it sends a new request for the resource identified by each element, often in parallel. The server returns one response for each image request, with a ContentType header telling what type of image it is (for instance image/gif) and the body containing the bytes that make up the image. The browser then bines all responses to render the plete page.附錄2:英文文獻(xiàn)翻譯HTTP和Servlet的基礎(chǔ)知識詳敘Requests讓我們仔細(xì)看看Requests。s an example:HTTP/ 200 OKLastModified: Mon, 20 Dec 2002 23:26:42 GMTDate: Tue, 11 Jan 2003 20:52:40 GMTStatus: 200ContentType: text/htmlServletEngine: Tomcat web Server/ContentLength: 59htmlbodyh1Hello World!/h1/body/htmlThe status line starts with the name of the protocol, followed by a status code and a short description of the status code. Here the status code is 200, meaning the request was executed successfully. The response message has headers just like the request message. In this example, the LastModified header gives the date and time for when the resource was last modified. The browser can use this information as a timestamp in a local cache。s just a name that means something to the server. The web server is configured to map these unique names to the real resources.Responses in DetailWhen the web server receives the request, it looks at the URL and decides, based on configuration information, how to handle it. It may handle it internally by simply reading an HTML file from the filesystem, or it can forward the request to some ponent that is responsible for the resource corresponding to the URL. This can be a program that uses database information, for instance, to dynamically generate an appropriate response. To the browser it makes no difference how the request is handled。s no way to tell if the / URL corresponds to a file or something else。t necessarily correspond to a static file on the server. It can identify an executable program, a record in a database, or pretty much anything the web server knows about. That39。s unique features. It can also tell if a client other than an HTML browser is used, such as a Wireless Markup Language (WML) browser on a cell phone or a PDA device, and generate an appropriate response.The Accept headers provide information about the languages and file formats the browser accepts. These headers can be used to adjust the response to the capabilities of the browser and the user39。 enUS。 U。s address field, or click on a link, the request is sent as a GET request to the server.The request headers provide additional information the server may use to process the request. The message body is included only in some types of requests, like the POST request discussed later.Here39。t necessarily part of the URL. For example, when the request has been delivered to the server, the location is a given, and only the resource identifier is important.The browser uses the URL information to create the request message it sends to the specified server using the specified protocol. An HTTP request message consists of three things: a request line, request headers, and possibly a request body.The request line starts with the request method name, followed by a resource identifier and the protocol version used by the browser:GET / HTTP/The most monly used request method is named GET. As the name implies, a GET request is used to retrieve a resource from the server. It39。s address field. To send a request, the browser needs to know which server to talk to and which resource to ask for. This information is specified by an HTTP Uniform Resource Locator (URL):The first part of the URL shown specifies that the request is made using the HTTP protocol. This is followed by the name of the server, in this case . The web server waits for requests to e in on a specific TCP/IP port. Port number 80 is the standard port for HTTP requests. If the web server uses another port, the URL must specify the port number in addition to the server name. For example::8080/This request is sent to a server that uses port 8080 instead of 80. The last part of the URL, /, identifies the resource that the client is requesting.A URL is actually a specialization of a Uniform Resource Identifier (URL, defined in the RFC2396 specification). A URL identifies a resource partly by its location, for instance the server that contains the resource. Another type of URL is a Uniform Resource Name (URN), which is a globally unique identifier that is valid no matter where the resource is located. HTTP deals only with the URL variety. The terms URL and URL are often used interchangeable, and unfortunately, they have slightly different definitions in different specifications. I39。最后,向在百忙中抽出時(shí)間對本文進(jìn)行評審并提出寶貴意見的各位老師表示衷心地感謝!2009年12月30日參考文獻(xiàn)[1] 飛思科技開發(fā)中心.JSP應(yīng)用開發(fā)