tomcat如何路由映射网址
来源:互联网 发布:瑜伽初学者 知乎 编辑:程序博客网 时间:2024/05/01 10:58
对于web容器来说,根据请求客户端路径路由到对应的资源属于其核心功能,假设用户在自己电脑上使用浏览器输入网址http://www.test.com/test/index.jsp,报文通过互联网网络到达该主机服务器,服务器应将其转到test应用的index.jsp页面中进行处理,然后再返回。针对tomcat,为了更加详细说清楚这个过程,引入一张图,
客户端浏览器输入http://tomcat.apache.org/tomcat-7.0-doc/index.html时,浏览器产生的HTTP报文大致如下:
GET /tomcat-7.0-doc/index.html HTTP/1.1Host: tomcat.apache.orgConnection: keep-aliveCache-Control: max-age=0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Upgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36Accept-Encoding: gzip, deflate, sdchAccept-Language: zh-CN,zh;q=0.8
详细的HTTP报文格式可自行查资料,其中重点看加粗的报文,“Host: tomcat.apache.org”表明访问的主机是“tomcat.apache.org”,而“/tomcat-7.0-doc/index.html”则表示请求的资源是“tomcat-7.0-doc”web应用的“index.html”页面,tomcat通过解析这些报文就可以知道该请求对应的资源,由于tomcat根据请求路径对处理进行了容器级别的分层,所以“tomcat.apache.org”对应Host容器,“tomcat-7.0-doc”对应Context容器,“index.html”对应Wrapper容器。
对应上面的请求,该web项目对应的配置文件主要如下:
<Host name="tomcat.apache.org" appBase="webapps" autoDeploy="true"> <Context path="/tomcat-7.0-doc" docBase=" /usr/tomcat/tomcat-7.0-doc"/></Host>
当Tomcat启动好后,http://tomcat.apache.org/tomcat-7.0-doc/index.html请求就会被tomcat的路由器通过匹配算法路由到名为“tomcat.apache.org”的Host容器上,然后在该容器中继续匹配名为“tomcat-7.0-doc”的Context容器(web应用),最后在该Context容器中匹配index.html资源,然后返回给客户端。
- tomcat如何路由映射网址
- tomcat请求路由映射核心组件Mapper
- MVC中的网址路由
- mvc 路由 映射
- mvc 路由 映射
- 路由映射Route
- 路由映射外网
- ASP.NET MVC路由扩展:路由映射
- ASP.NET的路由系统:路由映射
- ASP.NET MVC路由扩展:路由映射
- Tomcat中如何访问没有做映射的Servlet
- tomcat 如何把请求(request)映射到servlet
- tomcat如何映射其他盘符的工程
- tomcat配置目录映射,以及前台如何访问的注意事项
- MFC消息映射及路由
- nodejs 路由(URL映射)
- tomcat官方网址
- Tomcat+路由+花生壳 步骤:
- [Jenkins] Use python requests to programatically get and set Jenkins job configuration
- delphiXE Implicit string cast from 'AnsiString' to 'string'
- 浅谈Java设计模式(十)桥接模式(Bridge)
- C语言断言(assert)小结
- Windows下配置R-FCN
- tomcat如何路由映射网址
- TopCoder SRM 694
- Xilinx FPGA上电时序分析与设计
- SCU2016-04 C题模拟
- android lcd 背光控制流程
- javaWeb基本的pom.xml配置
- nodejs模块nodemailer基本使用-邮件发送(支持附件)
- 转:AngularJS性能优化总结篇
- 关于Xilinx FPGA JTAG下载时菊花链路中的芯片数量