Home > other >  The fifth chapter Web principle and application development
The fifth chapter Web principle and application development

Time:10-12

1. From a technical point of view, the WWW is a based on HTTP client/server application system, which belongs to the client/server paradigm of distributed computing applications, WWW core technologies include HTML and HTTP, among them, the negative using HTTP is the WWW server application layer protocol, used to implement the WWW communication between the client and the WWW server; HTML is the WWW service information form, used to define the storage of information in the WWW server format,

2. The principle of the HTTP protocol

1) to establish a TCP connectionWeb browser and the Web server to establish connections, open a called socket (socket) virtual file, the file marks the establishment of the connection is established successfully,
2) the web browser sends a request to a web server command
Once the TCP connection is established, the web browser will send a request to a web server command,
For example: GET/sampe/hello. JSP HTTP/1.1
3) the web browser sends a request header
Browser sends the request after the command, but also in the form of header information to the web server sends some information, after the browser sends a blank line, and inform the server it has ended the headers sent,
4) server response: a Web browser to submit request, through the HTTP protocol to the Web server, Web server, after receiving the transaction processing, processing results and returned via HTTP to the Web browser, which shows that the requested page on the Web browser,
Common HTTP headers are:
(1) the HTTP 1.0 200 OK this is the first line of the Web server response, list the HTTP server is running the version number and reply code, the code "200 OK" said request is completed,
(2) MIME_Version: version 1.0 it indicates the MIME type,
(3) content_type: type the header information is very important, it indicates the HTTP body the MIME type of information, such as: content_type: text/HTML indicates the data transmission is an HTML document,
(4) content_length: length value indicating the HTTP body length (bytes) of information,
5) web server response header
As the client with the request to send information about itself, the server will be along with the response to the user on its own data and the requested documents,
6) a web server to send data to the browser
Web server to the browser sent after the header information, will send a blank line to represent the headers sent to this end, then, it described the content-type response header format to send the actual data of the user's request,
7) web server shut down TCP connections: when the response is complete, a web browser and the web server must be broken, in place to ensure that other web browsers to establish the connection with the web server,

3. The HTTP request
HTTP request information consists of three parts (including request and there is a blank line between request body) : URL agreement/version request method, request headers, request body,
HTTP requests the commonly used method is GET, POST, HEAD, PUT, and so on,

4. The principle of CGI
Common gateway interface (CGI) is one of the most important technology in the WWW technology, has the irreplaceable important position, CGI is an external application with a web server is the interface between the standard, is the CGI program and pass information between a web server procedures,

5. The Cookie and Session mechanism
Cookie mechanism: orthodox cookie distribution is implemented by extending the HTTP protocol, the server in the HTTP response headers with a line of special instructions to prompt the browser in accordance with the instructions to generate the corresponding cookies,

Session mechanism: the session is a server-side mechanism, the server USES a similar to a hash table structure (may also be the use of hash table) to store information,




  • Related