tomcat 的意义及作用


context path 是在tomcat 要支持多个应用时对每个应用的docBase做区别时的区分符。

 

打个比方假如你有两个请求:一个为 http:localhost:8080/test1/helloworld  另外一个为 http:localhost:8080/test2/helloworld

这时候你的

     第一个请求 context的配置为 <context path="test1" docBase="~/Documents/web1/" reloadable = true>

     第二个请求的 context的配置为 <context path="test2" docBase="~/Documents/web2/" reloadable = true>

 

第一个请求的path为 "test1",其对应的docBase路径是~/Documents/web1/,tomcat服务器在接收到请求后就会从这个~/Documents/web1/路径去调用某个class的用来处理请求 http:localhost:8080/test1/ 这种格式url请求

 

请求的path为 "test2",其对应的docBase路径是~/Documents/web2/,tomcat服务器在接收到请求后就会从这个~/Documents/web2/路径去调用某个class的用来处理请求 http:localhost:8080/test2/ 这种格式url请求

(假如你没有指定path,但是指定了docBase的时候这时候你访问的url不用带/path 就可以访问到docBase的服务了,如<context path="" docBase="~/Documents/web1/" reloadable = true>,访问url:http:localhost:8080/helloworld)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM