• 周六. 10 月 12th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

Java Web Learning (3) — how to publish a web project

King Wang

1 月 3, 2022

JavaWeb Study ( 3、 … and )— How to publish a WEB project / How browsers interact with servers

01 How to publish a WEB project

Web After application development , If you want to be accessible , Need to put web Give the directory where the application is located to web Server management , This process is called virtual directory mapping .

  • The way 1: hit war package , Release to Tomcat Of webapps Under the table of contents , Please refer to https://www.cnblogs.com/morewindows0/p/8280865.html

  • The way 2:IDEA 2018.1.6 Under the version , start-up Tomcat after ,out In the catalog artifacts The directory will automatically generate WEB Corresponding documents of the project , This file is the decompiled output file , You can copy and paste directly to Tomcat Of webapps Next .
     Insert picture description here
     Insert picture description here
     Insert picture description here
     Insert picture description here


02 How browsers interact with servers

  • B/S The interaction process

    event : Open the browser , Enter in the address bar URL Address http://localhost:8080/JavaWebDemo01/index.jsp

    What browsers and servers do :

    step1. Query the host name IP

    1. Browser according to host name localhost To the operating system Hosts Find the host name in the file IP Address .

    2. If the browser is not in Hosts The host name corresponding to… Is found in the file IP Address , Go to the Internet DNS The server Up lookup localhost Corresponding host address .

    In general ,localhost It corresponds to the local loopback address ,hosts The catalogue is usually in C:\Windows\System32\drivers\etc Next .

    step2. according to IP Connect WEB The server

    3. Browser found localhost This host corresponds to IP After the address , Just use the IP Address to Web The server .

    step3. towards WEB Server send http request

    4. Browser connected to web After the server , Just use http Protocol sends request to server , In the process of sending the request , The browser will go to Web The server transmits data as streams , tell Web The server needs to access the Web Under the application of Web resources index.jsp, Browser is based on GET still POST Send the request to the server , And the browser is based on HTTP agreement Requested , And the version number of the corresponding protocol .

    5. Browser finished above 4 After step work , Just wait , wait for Web The server puts what it wants to access index.jsp This Web Resource transfer to it .

    step4. from http The request parses the client’s access requirements and sends back the data as required

    6. After the server receives the data transmitted by the browser , Start parsing the received data , When the server parses the contents, it knows that what the client browser wants to access is JavaWebDemo01 In the app index.jsp This Web resources , Then the server goes to read index.jsp This Web Contents of resources , Read the content again with Stream( flow ) The form of transmission to the browser .

    7. After the browser gets the data that the server transmits to it , You can show the data to users .


发表回复