gpt4 book ai didi

java - 如何在命令行中通过 Apache Ant 样式变量替换设置 tomcat 的上下文属性?

转载 作者:行者123 更新时间:2023-11-28 22:11:01 25 4
gpt4 key购买 nike

我想在启动 tomcat 之前使上下文的 unloadDelay 属性可配置。目前,我使用 sed 来替换值。但是,我发现它可以通过 Apache Ant 样式的变量替换 进行配置。我试图找出 -D 语法参数名称,但我没有。 https://tomcat.apache.org/tomcat-8.0-doc/config/index.html

那么,有人能告诉我配置 unloadDelay 的确切参数名称或构建与 tomcat 配置相关的任何参数的模式吗?

最佳答案

你可以试试这个:从命令行启动 tomcat:

bin/startup -app.unloadingDelay 60000

修改您的 conf/context.xml 并使用以上属性:

<Context unloadDelay="${app.unloadingDelay}"> 

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->

<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->

不要使用任何关键字或属性作为属性名称。引用: https://tomcat.apache.org/tomcat-7.0-doc/config/index.html

Tomcat configuration files are formatted as schemaless XML; elements and attributes are case-sensitive. Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file.

详细:

https://tomcat.apache.org/tomcat-3.3-doc/serverxml.html#substitution

关于java - 如何在命令行中通过 Apache Ant 样式变量替换设置 tomcat 的上下文属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45952062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com