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)
