I’m developing a JSP/Servlet webapp on Tomcat.
How should I refresh some things (servlet classes, web.xml, JSPs etc.) while it is functioning?
I can use a boolean variable in my servlets to detect it will be a maintenance period so all the requests will be ignored. (All my servlets extend my own base servlet class, so the only thing I have to do is an “if” check in my base class and a getter/setter to the boolean) But this is not enough to refresh the files.
Do I have to switch off my app, replace the things and redeploy?
I’d like to show a “Maintenance period, please wait…” page to my users while I’m refreshing the app.
How should I do that?
Having a “maintenance” page is only possible if you front Tomcat by another webserver. A commonly used approach is Apache HTTPD which is connected to Tomcat by mod_jk. When maintaining the webapplication on Tomcat, just let HTTPD display the maintenance page instead of forwarding the request to Tomcat.