标签:reserve AC insecure update doc 文件内容 diff invalid glassfish
https://mp.weixin.qq.com/s/PjcA22STEDGwRxVQweObQQ
Java Web中的Request对象是哪里来的?Response对象的角色是什么?
Java Web中的Session对象中信息是哪里来的?
词汇表:
SRC: 源IP,源端口等
DST: 目的IP,目的端口等
Application Container: 应用容器,如Tomcat, Glassfish,解析执行Java Servlet, Structs等程序;
Browser: 浏览器
Client_Port: (1024, 65535), 不固定,创建Socket时,操作系统协议栈自主选择;
一. 通信拓扑图
典型交互过程如下:
1. 用户点击URL或按钮。注意,这里是在客户端电脑上,与服务端时物理隔离的,跨越高山和大海。
2. 浏览器将URL或按钮点击事件,按照HTTP协议,封装成HTTP请求信息,包括Headers/Content;
3. HTTP协议将请求内容下发给TCP协议:TCP协议加上TCP头(包括源端口和目的端口),传递给IP层;
4. IP协议加上IP头(包括源IP地址和目的IP地址),把TCP报文转换成IP包,然后交给数据链路层;
5. 数据链路层加上MAC头,交给物理层;
6. 物理层加上物理头,把帧转换成物理信号发送到网线上;
7. 中间设备(交换机、路由器、边界路由器)不停的变更MAC头、物理头,把IP分组转发到下一跳;
8. IP分组跨越高山和大海,来到了服务器;
9. 服务器逐层解封IP头,TCP头,把HTTP请求交给HTTP服务器;
10.HTTP服务器按照HTTP协议,解析HTTP请求头,把请求信息传递给应用容器;
11.应用容器把请求信息封装成Request对象,并创建Response对象。把Request/Response对象传递给URL处理程序(Action);
12.URL处理程序根据Request封装的请求信息,把响应信息写入Response对象之后结束;
13.应用容器把Response对象包含的信息,按照HTTP协议,转换成HTTP Response信息,包括响应头和响应内容;
14.HTTP服务器把HTTP Response信息,发送给浏览器;
15.层层封装...
16.跨越高山和大海;
17.浏览器接收到HTTP Response信息,把响应内容显示出来;
二. 最终化身:HTTP
浏览器和HTTP服务器之间通过HTTP协议进行交互,所有的沟通交流都通过HTTP进行。
包括:信息传递,命令请求等,命令本身也是信息。
1. 石器时代
所有的网页都是静态html页面,服务器根据请求的URL,直接以http形式返回html文件内容。
eg.
Request: GET /news/today.html Host: 192.168.68.51:8000 Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Accept: image/webp,image/apng,image/*,*/*;q=0.8 Referer: http://192.168.68.51:8000/index.jsp Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.8,en;q=0.6 Response: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Pragma: No-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:02 GMT Content-Type: image/jpeg;charset=UTF-8 Transfer-Encoding: chunked Date: Thu, 21 Jun 2018 04:57:27 GMT <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="/styles/index.css?V=V808R08M03SP12"> <script type="text/javascript" src="/scripts/util.js?V=V808R08M03SP12"></script> </head> <body style="background-color: white;" onresize="setIndexTop();"> ////////////// </body> </html>
2. 近现代
根据用户请求的URL选择shtml模板文件,使用动态信息替换模板中的特定位置,
如使用当前日期,替换文件中的<% date %>.
返回替换之后的文件内容。
用户请求的URL决定了选择的模板文件。
3. 现代
分工更明确,更细化。
HTTP Server处理HTTP协议,应用服务器执行处理程序。
AJAX进行异步处理。
URL对应到Action类,GET/POST/UPDATE/DELETE等方法对应到要执行的函数(RESTful);
三. 生命周期: Request/Response & Session & Application
这个针对服务端。
HTTP服务器和引用容器通常是一个应用里执行,进程启动时,Application即建立,在进程运行期间一直存在。
Session通常针对用户而言,用户无论是游客,还是登陆用户,通过浏览器第一次访问服务端时建立Session,
在之后的多次访问中,Session继续存在。一般情况下,Session会自动超时消失。用户登出时也会终止之前的Session。
浏览器每发起一次URL请求,都会创建和销毁Request/Response。
四. 应用容器的作用
略
PS.
请求MAC帧的内容,示例如下:
Packet Info Packet Number: 315 Flags: 0x00000000 Status: 0x00000000 Packet Length: 667 Timestamp: 13:53:12.025787000 06/21/2018 Ethernet Type 2 Destination: D4:AE:52:C6:74:97 Dell:C6:74:97 [0-5] Source: 34:17:EB:B7:09:4A [6-11] Protocol Type: 0x0800 IP [12-13] IP Version 4 Header - Internet Protocol Datagram Version: 4 [14 Mask 0xF0] Header Length: 5 (20 bytes) [14 Mask 0x0F] Diff. Services: %00000000 [15] 0000 00.. Default .... ..00 Not-ECT Total Length: 649 [16-17] Identifier: 8245 [18-19] Fragmentation Flags: %010 [20 Mask 0xE0] 0.. Reserved .1. Do Not Fragment ..0 Last Fragment Fragment Offset: 0 (0 bytes) [20-21 Mask 0x1FFF] Time To Live: 128 [22] Protocol: 6 TCP - Transmission Control Protocol [23] Header Checksum: 0x0000 Checksum invalid. Should be: 0xCE3A [24-25] Source IP Address: 192.168.68.124 [26-29] Dest. IP Address: 192.168.68.50 [30-33] TCP - Transport Control Protocol Source Port: 53347 [34-35] Destination Port: 6080 [36-37] Sequence Number: 3277077179 [38-41] Ack Number: 2266623614 [42-45] TCP Offset: 5 (20 bytes) [46 Mask 0xF0] Reserved: %0000 [46 Mask 0x0F] TCP Flags: %00011000 ...AP... [47] 0... .... (No Congestion Window Reduction) .0.. .... (No ECN-Echo) ..0. .... (No Urgent pointer) ...1 .... Ack .... 1... Push .... .0.. (No Reset) .... ..0. (No SYN) .... ...0 (No FIN) Window: 64240 [48-49] TCP Checksum: 0x0C7B Checksum invalid. Should be: 0xD73D [50-51] Urgent Pointer: 0 [52-53] No TCP Options Application Layer Data Area: GET /xxxxxx/xx/x 47 45 54 20 2F 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E [54-69] xxxx.aspx HTTP/1 6F 67 69 6E 2E 61 73 70 78 20 48 54 54 50 2F 31 [70-85] .1..Host: xxxxxx 2E 31 0D 0A 48 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E [86-101] xxxxxxxxxxx:6080 69 64 75 63 74 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E 4E [102-117] ..Connection: ke 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 6B 65 [118-133] ep-alive..Upgrad 65 70 2D 61 6C 69 76 65 0D 0A 55 70 67 72 61 64 [134-149] e-Insecure-Reque 65 2D 49 6E 73 65 63 75 72 65 2D 52 65 71 75 65 [150-165] sts: 1..User-Age 73 74 73 3A 20 31 0D 0A 55 73 65 72 2D 41 67 65 [166-181] nt: Mozilla/5.0 6E 74 3A 20 4D 6F 7A 69 6C 6C 61 2F 35 2E 30 20 [182-197] (Windows NT 6.1) 28 57 69 6E 64 6F 77 73 20 4E 54 20 36 2E 31 29 [198-213] AppleWebKit/537 20 41 70 70 6C 65 57 65 62 4B 69 74 2F 35 33 37 [214-229] .36 (KHTML, like 2E 33 36 20 28 4B 48 54 4D 4C 2C 20 6C 69 6B 65 [230-245] Gecko) Chrome/6 20 47 65 63 6B 6F 29 20 43 68 72 6F 6D 65 2F 36 [246-261] 0.0.3112.113 Saf 30 2E 30 2E 33 31 31 32 2E 31 31 33 20 53 61 66 [262-277] ari/537.36..Acce 61 72 69 2F 35 33 37 2E 33 36 0D 0A 41 63 63 65 [278-293] pt: text/html,ap 70 74 3A 20 74 65 78 74 2F 68 74 6D 6C 2C 61 70 [294-309] plication/xhtml+ 70 6C 69 63 61 74 69 6F 6E 2F 78 68 74 6D 6C 2B [310-325] xml,application/ 78 6D 6C 2C 61 70 70 6C 69 63 61 74 69 6F 6E 2F [326-341] xml;q=0.9,image/ 78 6D 6C 3B 71 3D 30 2E 39 2C 69 6D 61 67 65 2F [342-357] webp,image/apng, 77 65 62 70 2C 69 6D 61 67 65 2F 61 70 6E 67 2C [358-373] */*;q=0.8..Accep 2A 2F 2A 3B 71 3D 30 2E 38 0D 0A 41 63 63 65 70 [374-389] t-Encoding: gzip 74 2D 45 6E 63 6F 64 69 6E 67 3A 20 67 7A 69 70 [390-405] , deflate..Accep 2C 20 64 65 66 6C 61 74 65 0D 0A 41 63 63 65 70 [406-421] t-Language: zh-C 74 2D 4C 61 6E 67 75 61 67 65 3A 20 7A 68 2D 43 [422-437] N,zh;q=0.8,en;q= 4E 2C 7A 68 3B 71 3D 30 2E 38 2C 65 6E 3B 71 3D [438-453] 0.6..Cookie: CCS 30 2E 36 0D 0A 43 6F 6F 6B 69 65 3A 20 43 43 53 [454-469] =; ASP.NET_Sessi 3D 3B 20 41 53 50 2E 4E 45 54 5F 53 65 73 73 69 [614-629] onId=14qdlj42ew1 6F 6E 49 64 3D 31 34 71 64 6C 6A 34 32 65 77 31 [630-645] 1gzzc2sj5xp2u... 31 67 7A 7A 63 32 73 6A 35 78 70 32 75 0D 0A 0D [646-661] . 0A [662] FCS - Frame Check Sequence FCS: 0xBFDC4562 Calculated
响应MAC帧内容,示例如下:
Packet Info Packet Number: 318 Flags: 0x00000000 Status: 0x00000000 Packet Length: 1518 Timestamp: 13:53:12.062176000 06/21/2018 Ethernet Type 2 Destination: 34:17:EB:B7:09:4A [0-5] Source: D4:AE:52:C6:74:97 Dell:C6:74:97 [6-11] Protocol Type: 0x0800 IP [12-13] IP Version 4 Header - Internet Protocol Datagram Version: 4 [14 Mask 0xF0] Header Length: 5 (20 bytes) [14 Mask 0x0F] Diff. Services: %00000000 [15] 0000 00.. Default .... ..00 Not-ECT Total Length: 1500 [16-17] Identifier: 17809 [18-19] Fragmentation Flags: %010 [20 Mask 0xE0] 0.. Reserved .1. Do Not Fragment ..0 Last Fragment Fragment Offset: 0 (0 bytes) [20-21 Mask 0x1FFF] Time To Live: 128 [22] Protocol: 6 TCP - Transmission Control Protocol [23] Header Checksum: 0xA58B [24-25] Source IP Address: 192.168.68.50 [26-29] Dest. IP Address: 192.168.68.124 [30-33] TCP - Transport Control Protocol Source Port: 6080 [34-35] Destination Port: 53347 [36-37] Sequence Number: 2266623614 [38-41] Ack Number: 3277077788 [42-45] TCP Offset: 5 (20 bytes) [46 Mask 0xF0] Reserved: %0000 [46 Mask 0x0F] TCP Flags: %00010000 ...A.... [47] 0... .... (No Congestion Window Reduction) .0.. .... (No ECN-Echo) ..0. .... (No Urgent pointer) ...1 .... Ack .... 0... (No Push) .... .0.. (No Reset) .... ..0. (No SYN) .... ...0 (No FIN) Window: 64240 [48-49] TCP Checksum: 0xCD6F [50-51] Urgent Pointer: 0 [52-53] No TCP Options Application Layer Data Area: HTTP/1.1 200 OK. 48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F 4B 0D [54-69] .Cache-Control: 0A 43 61 63 68 65 2D 43 6F 6E 74 72 6F 6C 3A 20 [70-85] no-store..Pragma 6E 6F 2D 73 74 6F 72 65 0D 0A 50 72 61 67 6D 61 [86-101] : no-cache..Cont 3A 20 6E 6F 2D 63 61 63 68 65 0D 0A 43 6F 6E 74 [102-117] ent-Length: 4688 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 34 36 38 38 [118-133] ..Content-Type: 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 [134-149] text/html; chars 74 65 78 74 2F 68 74 6D 6C 3B 20 63 68 61 72 73 [150-165] et=gb2312..Expir 65 74 3D 67 62 32 33 31 32 0D 0A 45 78 70 69 72 [166-181] es: 0..Server: M 65 73 3A 20 30 0D 0A 53 65 72 76 65 72 3A 20 4D [182-197] icrosoft-IIS/7.5 69 63 72 6F 73 6F 66 74 2D 49 49 53 2F 37 2E 35 [198-213] ..X-AspNet-Versi 0D 0A 58 2D 41 73 70 4E 65 74 2D 56 65 72 73 69 [214-229] on: 4.0.30319..P 6F 6E 3A 20 34 2E 30 2E 33 30 33 31 39 0D 0A 50 [230-245] 3P: CP=CAO PSA O 33 50 3A 20 43 50 3D 43 41 4F 20 50 53 41 20 4F [246-261] UR..P3P: CP=CAO 55 52 0D 0A 50 33 50 3A 20 43 50 3D 43 41 4F 20 [262-277] PSA OUR..X-Power 50 53 41 20 4F 55 52 0D 0A 58 2D 50 6F 77 65 72 [278-293] ed-By: ASP.NET.. 65 64 2D 42 79 3A 20 41 53 50 2E 4E 45 54 0D 0A [294-309] Date: Thu, 21 Ju 44 61 74 65 3A 20 54 68 75 2C 20 32 31 20 4A 75 [310-325] n 2018 05:51:52 6E 20 32 30 31 38 20 30 35 3A 35 31 3A 35 32 20 [326-341] GMT......<!DOCTY 47 4D 54 0D 0A 0D 0A 0D 0A 3C 21 44 4F 43 54 59 [342-357] PE html PUBLIC " 50 45 20 68 74 6D 6C 20 50 55 42 4C 49 43 20 22 [358-373] -//W3C//DTD XHTM 2D 2F 2F 57 33 43 2F 2F 44 54 44 20 58 48 54 4D [374-389] L 1.0 Transition 4C 20 31 2E 30 20 54 72 61 6E 73 69 74 69 6F 6E [390-405] al//EN" "http:// 61 6C 2F 2F 45 4E 22 20 22 68 74 74 70 3A 2F 2F [406-421] www.w3.org/TR/xh 77 77 77 2E 77 33 2E 6F 72 67 2F 54 52 2F 78 68 [422-437] tml1/DTD/xhtml1- 74 6D 6C 31 2F 44 54 44 2F 78 68 74 6D 6C 31 2D [438-453] transitional.dtd 74 72 61 6E 73 69 74 69 6F 6E 61 6C 2E 64 74 64 [454-469] ">..<html xmlns= 22 3E 0D 0A 3C 68 74 6D 6C 20 78 6D 6C 6E 73 3D [470-485] "http://www.w3.o 22 68 74 74 70 3A 2F 2F 77 77 77 2E 77 33 2E 6F [486-501] rg/1999/xhtml">. 72 67 2F 31 39 39 39 2F 78 68 74 6D 6C 22 3E 0D [502-517] .<head><title>.. 0A 3C 68 65 61 64 3E 3C 74 69 74 6C 65 3E 0D 0A [518-533] .......</title>. 09 B5 C7 C2 BD 0D 0A 3C 2F 74 69 74 6C 65 3E 0D [534-549] ..... <script 0A 0D 0A 0D 0A 20 20 20 20 3C 73 63 72 69 70 74 [550-565] language="JavaS 20 6C 61 6E 67 75 61 67 65 3D 22 4A 61 76 61 53 [566-581] cript" src="./.. 63 72 69 70 74 22 20 73 72 63 3D 22 2E 2F 2E 2E [582-597] /Comm/JScript.js 2F 43 6F 6D 6D 2F 4A 53 63 72 69 70 74 2E 6A 73 [598-613] "></script>.. 22 3E 3C 2F 73 63 72 69 70 74 3E 0D 0A 20 20 20 [614-629] <meta http-equiv 3C 6D 65 74 61 20 68 74 74 70 2D 65 71 75 69 76 [630-645] ="Page-Enter" co 3D 22 50 61 67 65 2D 45 6E 74 65 72 22 20 63 6F [646-661] ntent="revealTra 6E 74 65 6E 74 3D 22 72 65 76 65 61 6C 54 72 61 [662-677] ns(duration=0.5, 6E 73 28 64 75 72 61 74 69 6F 6E 3D 30 2E 35 2C [678-693] transition=8)" 20 74 72 61 6E 73 69 74 69 6F 6E 3D 38 29 22 20 [694-709] />.. <script l 2F 3E 0D 0A 20 20 20 3C 73 63 72 69 70 74 20 6C [710-725] anguage="JavaScr 61 6E 67 75 61 67 65 3D 22 4A 61 76 61 53 63 72 [726-741] ipt" src="./../C 69 70 74 22 20 73 72 63 3D 22 2E 2F 2E 2E 2F 43 [742-757] omm/JS/Calendar/ 6F 6D 6D 2F 4A 53 2F 43 61 6C 65 6E 64 61 72 2F [758-773] WdatePicker.js" 57 64 61 74 65 50 69 63 6B 65 72 2E 6A 73 22 20 [774-789] defer="defer" >< 64 65 66 65 72 3D 22 64 65 66 65 72 22 20 3E 3C [790-805] /script>.. <me 2F 73 63 72 69 70 74 3E 0D 0A 20 20 20 3C 6D 65 [806-821] ta http-equiv="C 74 61 20 68 74 74 70 2D 65 71 75 69 76 3D 22 43 [822-837] ache-Control" co 61 63 68 65 2D 43 6F 6E 74 72 6F 6C 22 20 63 6F [838-853] ntent="no-store" 6E 74 65 6E 74 3D 22 6E 6F 2D 73 74 6F 72 65 22 [854-869] /><meta http-eq 20 2F 3E 3C 6D 65 74 61 20 68 74 74 70 2D 65 71 [870-885] uiv="Expires" co 75 69 76 3D 22 45 78 70 69 72 65 73 22 20 63 6F [886-901] ntent="0" /><met 6E 74 65 6E 74 3D 22 30 22 20 2F 3E 3C 6D 65 74 [902-917] a http-equiv="Pr 61 20 68 74 74 70 2D 65 71 75 69 76 3D 22 50 72 [918-933] agma" content="n 61 67 6D 61 22 20 63 6F 6E 74 65 6E 74 3D 22 6E [934-949] o-cache" />..<st 6F 2D 63 61 63 68 65 22 20 2F 3E 0D 0A 3C 73 74 [950-965] yle type="text/ 79 6C 65 20 20 74 79 70 65 3D 22 74 65 78 74 2F [966-981] css">..body..{.. 63 73 73 22 3E 0D 0A 62 6F 64 79 0D 0A 7B 0D 0A [982-997] .margin: 0 auto; 09 6D 61 72 67 69 6E 3A 20 30 20 61 75 74 6F 3B [998-1013] ...font-size: 14 0D 0A 09 66 6F 6E 74 2D 73 69 7A 65 3A 20 31 34 [1014-1029] px;...color: #00 70 78 3B 0D 0A 09 63 6F 6C 6F 72 3A 20 23 30 30 [1030-1045] 0;...line-height 30 3B 0D 0A 09 6C 69 6E 65 2D 68 65 69 67 68 74 [1046-1061] : 20px;...font-f 3A 20 32 30 70 78 3B 0D 0A 09 66 6F 6E 74 2D 66 [1062-1077] amily: ....;...t 61 6D 69 6C 79 3A 20 CB CE CC E5 3B 0D 0A 09 74 [1078-1093] ext-align:center 65 78 74 2D 61 6C 69 67 6E 3A 63 65 6E 74 65 72 [1094-1109] ;...width:80%;.. 3B 0D 0A 09 77 69 64 74 68 3A 38 30 25 3B 0D 0A [1110-1125] }.. #ImgIc 7D 0D 0A 20 20 20 20 20 20 20 23 49 6D 67 49 63 [1126-1141] on.. {.. 6F 6E 0D 0A 20 20 20 20 20 20 20 7B 0D 0A 20 20 [1142-1157] .width:8px; 20 20 20 20 20 09 77 69 64 74 68 3A 38 70 78 3B [1158-1173] .. .height 0D 0A 20 20 20 20 20 20 20 09 68 65 69 67 68 74 [1174-1189] :8px;.. }. 3A 38 70 78 3B 0D 0A 20 20 20 20 20 20 20 7D 0D [1190-1205] ..Baner..{.. 0A 2E 42 61 6E 65 72 0D 0A 7B 0D 0A 20 20 20 20 [1206-1221] text-align:cente 74 65 78 74 2D 61 6C 69 67 6E 3A 63 65 6E 74 65 [1222-1237] r;..}...Footer.. 72 3B 0D 0A 7D 0D 0A 2E 46 6F 6F 74 65 72 0D 0A [1238-1253] {.. text-alig 7B 0D 0A 20 20 20 20 74 65 78 74 2D 61 6C 69 67 [1254-1269] n:center;.. b 6E 3A 63 65 6E 74 65 72 3B 0D 0A 20 20 20 20 62 [1270-1285] ackground-color: 61 63 6B 67 72 6F 75 6E 64 2D 63 6F 6C 6F 72 3A [1286-1301] Gray;.. font- 47 72 61 79 3B 0D 0A 20 20 20 20 66 6F 6E 74 2D [1302-1317] style:normal;.. 73 74 79 6C 65 3A 6E 6F 72 6D 61 6C 3B 0D 0A 20 [1318-1333] float:inheri 20 20 20 20 66 6C 6F 61 74 3A 69 6E 68 65 72 69 [1334-1349] t;..}...Main..{. 74 3B 0D 0A 7D 0D 0A 2E 4D 61 69 6E 0D 0A 7B 0D [1350-1365] . height:100% 0A 20 20 20 20 68 65 69 67 68 74 3A 31 30 30 25 [1366-1381] ;..}....div#Top. 3B 0D 0A 7D 0D 0A 0D 0A 64 69 76 23 54 6F 70 0D [1382-1397] .{.. backgrou 0A 7B 0D 0A 20 20 20 20 62 61 63 6B 67 72 6F 75 [1398-1413] nd-position: rig 6E 64 2D 70 6F 73 69 74 69 6F 6E 3A 20 72 69 67 [1414-1429] ht center;.. 68 74 20 63 65 6E 74 65 72 3B 0D 0A 20 20 20 20 [1430-1445] margin: 0px;.. 6D 61 72 67 69 6E 3A 20 30 70 78 3B 0D 0A 20 20 [1446-1461] padding: 0px 3 20 20 70 61 64 64 69 6E 67 3A 20 30 70 78 20 33 [1462-1477] 0px 0px 0px;.. 30 70 78 20 30 70 78 20 30 70 78 3B 0D 0A 20 20 [1478-1493] height: 100%;. 20 20 68 65 69 67 68 74 3A 20 31 30 30 25 3B 0D [1494-1509] . 0A 20 20 20 [1510-1513] FCS - Frame Check Sequence FCS: 0xF481CF5F Calculated
标签:reserve AC insecure update doc 文件内容 diff invalid glassfish
原文地址:https://www.cnblogs.com/wjcdx/p/9211373.html