Reputation: 8913
I want to understand how the web-container maps incoming requests to a particular web-application (and a servlet afterwards).
To begin with, I believe a web-container must be able to listen for incoming Http requests (else how will the client reach to web-application at all). This assumption I believe holds correct. If this is not correct, then how does request will ever reach to web-container?
Now, assume I wrote a web-application (based on plain servlets i.e., not using any other framework like Spring MVC), create the .war file, say firstwebapp.war
; and deployed it in Apache Tomcat, with context root /firstapp
Now, the client makes request to the deployed web-application as:
http://servername:port/firstapp
How does the web-container handle this request? Where is this mapping of /firstapp to the web-application deployed as firstwebapp.war
?
Does web-container first "sees" the incoming request URL before passing on the control to respective web-application? And based on what criteria is it able to map to proper .war?
Upvotes: 1
Views: 251
Reputation: 2720
Yes, the server will see /firstapp
first and know where to rout it. After that it depends on your war, e.g., your web.xml
.
Upvotes: 1