简体   繁体   中英

How to remove deployed webapp in embedded Tomcat?

I'm using apache-tomcat-8.5.4-embed to load web application at runtime. I have a requirement to stop web application when user requested to stop. Is it possible to do, if yes please let me know the procedure!

Uday , something worth a try are API's that are available (more specifically for ANT) in tomcat

https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/ant/StopTask.html

I have not tested the code below , but it is something you could try.

StopTask stopTask= new StopTask(); 
stopTask.setUsername("admin"); 
stopTask.setPassword("mypass"); 
stopTask.setUrl("http://server:port/manager";); 
stopTask.setPath("/my-webapp-context"); 
stopTask.execute(); 

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