Reading book (a) analysis of the principle of web operation

Source: Internet
Author: User
Tags soap

A probe into the web operation principle of Tomcat and Java Web Development technology

Become a Web development engineer, first of all understand the principle of web operation, the principle can take us better to solve the underlying problems, how to understand the current popular open source framework, and even how to write a framework.

1 What is Web?

The web is the most widely used distributed framework on the network. It uses the client/server communication mode, the client can be a browser, through the browser it can connect to the server, access to many servers to browse a variety of Web sites, which is why the Web is a distributed application framework.

2 URL

When we visit a website, we will display a website address in the browser, for example: http://www.claire.com/java/user/index.html; So how do we understand this URL?

It consists of the Application layer protocol (such as HTTP, FTP, etc.) + domain name or the path/file name where the host ip+ resource resides . And look at the URL just now, isn't that what happened?

3 HTTP

HTTP, Super Text Transfer protocol. It strictly regulates the HTTP request and HTTP response data format, as long as the HTTP server and the client to abide by this protocol, both sides can communicate smoothly, so the Web client is not necessarily a browser, Web server can also be used in many high-level languages to write.

The process of client and server communication takes four steps:

    • Client and server establish TCP connection
    • The client sends an HTTP request to the server
    • The server responds to the HTTP request and sends it to the client
    • To close a TCP connection

3.1 HTTP request format

According to the HTTP request protocol, it is divided into three parts: a request line, a request header, and a request body.

Request Line: Consists of a request method (such as get,post,put,delete, etc.), a URL, and an HTTP version.

Request Header: The request header contains very many messages, such as the type of the declaring browser, the length of the request body, the type, and so on.

Request Body: HTTP Specifies that there are two blank lines between the request body and the request header. A blank line is important, which represents the end of the request header and the beginning of the request body. The body of the request can be either a post form submission or a more informative one.

3.2 HTTP response format

According to the HTTP response protocol, it is divided into three parts: Response line, response header, and response body.

Response line: Consists of the version of the HTTP protocol, the status code and the description

Response headers: The response header can also contain many information, such as server information, the type and length of the response body, and so on.

Response Body: The response body is the information returned to the client, either HTML documents or other types of files, such as Rar,doc, which are prompted for download when IE is parsed.

3.3 MIME

The MIME type is the type of the body part, which is formatted by the body part of the HTTP specification and only follows this type to ensure that both parties can read the message.

File name extension MIME type
Unknown data type Content/unknown
. bin. exe. O. A. Z Application/octet-stream
. pdf Application/pdf
. zip Application/zip
. tar Application/x-tar
. gif Application/gif
. jpg. jpeg Image/jpeg
. html. htm Text/html
. text. C. h. txt. java Text/plain
. xml Application/xml

4 SOAP

SOAP (Simple Object access Protocol), a communication protocol used by Web servers, that specifies that the XML language is used for communication between the client and the server.

    • When the HTML sends the request, the client protocol connector first wraps the request into an XML-formatted SOAP request, which then wraps the soap into the body of the HTTP request, and finally the client Protocol connector sends an HTTP request to the Web server.
    • After the Web server obtains the HTTP request, the service-side protocol parser takes the HTTP request body part out, obtains the SOAP request, the SOAP has the most primitive body data, the Web server resolves it and responds.
    • The Web server encapsulates the original response as a result of the SOAP response, and the service-side protocol parser wraps it into the HTTP response body, and finally the service-side Protocol resolver sends the HTTP response to the client.
    • After the client Protocol Connector obtains the HTTP response, it takes out the HTTP response body part, the SOAP response result, fetches the most original response data and sends it to the client.

Reading book (a) analysis of the principle of web operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.