简体   繁体   中英

how does tomcat container differentiate which web.xml of war file to read when multiple war of different application is deployed

I am reading book Head first servlets and jsp, It says when tomcat container receive any request from the client then it reads the web.xml (deployment descriptor) to identify the correct servlet to process the given request.

Now suppose, when multiple wars of different application is deployed in the tomcat container, how does the container differentiate which web.xml of war file to read for the given request?

Does it looks at all the web.xml to find the correct servlet mapping for the given URL or it follows some other mechanism?

Based on the url root name, it is named according to how you set your WAR deployment.

For example I deploy mywar.war it will by default be mapped to localhost/mywar. Servlets are accessed like: localhost/mywar/myservlet

You can change the mapping name when deploying or with container specific descriptors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM