简体   繁体   English

如何禁用通过Tomcat中server.xml的Context元素定义的应用程序?

[英]How to disable application defined via Context element of server.xml in Tomcat?

I have a web application defined via <Context> element in my server.xml configuration on Tomcat. 我在Tomcat的server.xml配置中通过<Context>元素定义了一个Web应用程序。 I need to be able to automatically disable this application under certain conditions. 我需要能够在某些情况下自动禁用此应用程序。 The change should be effective after tomcat restart or sooner. 该更改应在tomcat重新启动后或更早生效。

Is there some configuration switch that I could use for that purpose? 我可以为此使用一些配置开关吗? I don't want to completely remove or comment out the Context node because it would add complexity to restoring the application (also done automatically under certain conditions). 我不想完全删除或注释掉Context节点,因为它会增加恢复应用程序的复杂性(在某些情况下也会自动完成)。

I tried deployIgnore attribute of Host element, but it only work for applications that are deployed by copying a war into webapps directory. 我尝试了Host元素的deployIgnore属性,但是它仅适用于通过将war复制到webapps目录中而部署的应用程序。 Application defined via Context is not affected. 通过Context定义的应用程序不受影响。

I'm using Tomcat 7, if it makes any difference. 我正在使用Tomcat 7,如果有什么不同的话。

Could you use the Tomcat Manager App to do this? 您可以使用Tomcat Manager应用程序执行此操作吗? You can make a web request to stop an app: 您可以提出网络请求以停止应用程序:

http://localhost:8080/manager/text/stop?path=/your_app

And then start the app in a similar way: 然后以类似方式启动应用程序:

http://localhost:8080/manager/text/start?path=/your_app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM