当前位置:网站首页>简述请求过程
简述请求过程
2022-06-13 09:25:00 【edui】
说说一个请求从浏览器到服务器响应的过程
1.先在本地查询时候有域名对应的ip,找不到再像DNS服务器请求寻找对应IP,找不到再向上层…到根域名服务器都找不到报错,任何一节找到就返回ip
2.如果使用tcp协议跟服务器通信需要进行三次握手(客户请求确认,服务器确认,客服确认收到确认),收到应答重传等,如果用UDP协议则不需要连接和应答直接一个劲的发送。
3.发送http请求,服务器获取解析封装请求信息分给相应处理返回结果。
4.四次挥手(客户请求断开,服务器收到,服务器通知关闭,客户确认收到关闭确认)等操作
**ps:**计算机通信本质就是进程之间的通信,一个计算机就是一个ip地址,再对应一个端口号就是计算机里的约定的对应端口的进程,就是传输层和应用层的网络接口。比如tomcat约定倾听8080端口,报文通过ip到服务器后再解析端口号为8080才进行处理不然就不接受。
tomcat处理请求过程
connector进行接受请求进行封装并且传递给container进行处理,container调用相应的servlet处理请求,dispatcherServlet就是一个servlet,处理所有请求,dispatcherServlet接受到请求后通过处理映射器HandleMapper寻找对应的Handle,然后通过处理器配适器区执行相应的Handle也就是控制器,然后执行结果返回modelAndView,然后dsipatchServlet将通过modelAndView去解析渲染视图然后返回给用户。
如下图,图在心中就可以。
说说你对容器的理解
容器比如tomcat容器就是一个web容器也就是servlet容器,容器容易类比到桶啊什么装东西的,装东西只是表面看起来好理解的,比如Spring容器说他是装所有类的容器好理解,更深层次的,不一定像桶一样装才叫容器,桶装水之所以好理解是因为我们能直观的看到水被装在一个视觉范围里,回到Spring等这些容器来,装的就是类,比如tomcat装的就是servlet然后其实也没像桶一样装,而是说管理类,比如tomcat会根据请求调用servlet的方法管理生命周期处理请求什么的。像Spring容器管理类的生命周期就是用到某个类时就根据bean对应的名称找到对应的类调用相应函数比如初始化等,容器就相当于中间商…负责管理分配相关资源的…
边栏推荐
- Dynamic display of analog clock using digital clock in turtle Library
- C language: file operation
- 【pytorch环境安装搭建】
- Attack and defense world PWN shell
- [poj1845] sumdiv [number theory]
- Tree and binary tree: basic operation and implementation of binary tree
- Exercise 7-10 finding specified characters (15 points)
- 攻防世界-PWN-shell
- Acwing785. quick sort (sort+ quick sort + merge sort)
- Haproxy + keepalived for high availability load balancing of MySQL
猜你喜欢
The turtle library displays the system time
云计算企业崛起 甲骨文数据库市场主导地位动摇
[Luogu p1403] Research on divisor
[poj1845] sumdiv [number theory]
Trees and binary trees: Construction of binary trees
[51nod 3062] n queen problem V2 [bit operation DFS]
全新BMW i3的操控,能符合对3系之名产品的期待吗?
C language: deep understanding of character functions and string functions (1)
Storage mode of drawings
(state compression dp+good) acwing 291 Mondrian's dream
随机推荐
Heap
1-2 24:00 (20 points) [CSP certification true question]
LeetCode 322. Change
Remember! Don't be too confident in writing code! Be sure to write some key log info output, or the problem will not be located.
[51nod p2106] an odd number of times [bit operation]
Biden: hope to sign the bipartisan gun safety reform bill as soon as possible
turtle库的使用数字时钟模拟时钟动态显示
Queue and stack
(tree DP) acwing 285 A dance without a boss
[implementation of depth first search]
虚拟化和云计算文章大合集
Sequential representation of linear tables
1-4 message passing interface [CSP authentication]
JS【中高级】部分的知识点我帮你们总结好了
Tree and binary tree: storage structure of binary tree
LeetCode 72. 编辑距离
[Luogu p1403] Research on divisor
LeetCode 5270. 网格中的最小路径代价(动态规划)
C language: recursive function to realize Hanoi Tower
LeetCode 6098. Count the number of subarrays whose score is less than K (prefix and + binary search)