I was configuring apache tomcat's context path to be root ('/'), but after doing that, I noticed whenever I started or restarted my server in eclipse, the root's servlet's doGet method would get called.
Here's what I did.
I added a "System.out.println("Hello World");" inside the doGet method of that servlet, so I noticed that when I start/restart the tomcat server in elcipse, the servlet's doGet method gets called.
Why does this happen, and is this normal behavior? I would imagine that the servlet's doGet method only gets called when a GET request is made to that servlet, so I don't understand why it's getting called when I start/restart the tomcat server in eclipse.
Tomcat does not do anything. However Eclipse's WTP plugin sends a real request for /
on all configured connectors to check if the server is running. If Tomcat answers the server's status in Eclipse changes from starting
to started/debugging
.
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.