On 12/08/2019 23:18, W wrote: > Hi, > I would like to find the war file name (for example, > ROOT##2019-08-12-10-44.war) inside > ServletContextListener.contextInitialized() and > ServletContextListener.contextDestroyed(). So I can send email to admins warn > them which app is up and down. > Is there a way to do it?
It isn't guaranteed to work in all circumstances but try: ServletContext.getRealPath("/") If that doesn't work then - assuming you can use reflection - something along these lines: Obtain the ServletConext. Cast it to org.apache.catalina.core.ApplicationContext Use reflection to read the context field or call getContext() which will return a StandardContext instance. Then you have various options: - call getDocbase() - call getPath() and getWebappVersion() and there are probably plenty of other similar approaches that would work. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org