当前位置:网站首页>简述请求过程
简述请求过程
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对应的名称找到对应的类调用相应函数比如初始化等,容器就相当于中间商…负责管理分配相关资源的…
边栏推荐
- Alibaba senior experts analyze the standard design of protocol
- [51nod p3216] Award [bit operation]
- Z字形变换
- [51nod p2673] shortest path [heap optimization Dijk]
- I set up a blog
- Trees and binary trees: Construction of binary trees
- [51nod P3210] binary statistics
- LeetCode 5270. 网格中的最小路径代价(动态规划)
- MOOC week 8 programming exercise 1
- HAProxy + Keepalived实现MySQL的高可用负载均衡
猜你喜欢
SQL ROW_ The number() function uses
[51nod p2673] shortest path [heap optimization Dijk]
acwing 790. The third root of a number (dichotomy)
(state compression dp+good) acwing 291 Mondrian's dream
【pytorch环境安装搭建】
[51nod p2106] an odd number of times [bit operation]
(dfs+ tree DP) acwing 846 Center of gravity of tree
[pytorch environment installation]
go-zero微服务实战系列(三、API定义和表结构设计)
Alibaba senior experts analyze the standard design of protocol
随机推荐
acwing 788. Number of pairs in reverse order
Timestamp to localdate
[Luogu p1403] Research on divisor
[51nod p2653] interval XOR [bit operation]
Britain introduces food security plan to resist food supply crisis
C language: sanziqi
[51nod p3395] n-bit gray code [bit operation]
JS【中高级】部分的知识点我帮你们总结好了
acwing 790. The third root of a number (dichotomy)
虚拟化和云计算文章大合集
VGA common resolution and calculation method
计算两个时间相差的天数(支持跨月、跨年)
LeetCode 5259. Calculate the total tax payable
[51nod p2527] or and sum [bit operation]
VDD,DVDD,AVDD,VCC,AFVDD,DOVDD,IOVDD
阿里高级专家剖析 | Protocol的标准设计
Exercise 7-7 string replacement (15 points)
马斯克的「元宇宙」梦
SQL ROW_ The number() function uses
LeetCode 6098. 统计得分小于 K 的子数组数目(前缀和+二分查找)