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)

 

相关文章:

  • 2021-12-05
  • 2023-02-27
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-08-03
  • 2021-07-01
  • 2022-12-23
  • 2021-11-24
  • 2021-09-27
  • 2022-01-30
相关资源
相似解决方案