[英]How to configure a webapps deployment directory in Jetty
这一定是一个简单的答案,但我似乎找不到!
我刚刚开始在CentOS 5.5上使用Jetty 7.0.2 ,并使用默认设置部署了一个webapp
(只需将我的 WAR 文件放在/webapps
目录中)。 当 Jetty 启动时,它会将战争解压到/tmp/jetty
{something-warfilename-etc} 目录中。
我知道 Jetty 有很多可以实现的自定义配置,但是现在,我只对设置提取的 war 文件的位置感兴趣,这样我就可以安全地修改.properties
文件等。
提前致谢!
为什么不把解压后的 war 文件放在webapps/
中呢?
正如他们的文档所说,如果 Jetty 在$JETTY_HOME/webapps/
中找到目录,它会很乐意将其部署为 servlet webapp。 然后您可以在不更改任何 Jetty 设置的情况下调整属性文件。
这也意味着当您拥有应用程序的新版本时,您不必担心 Jetty 会覆盖对属性文件的任何更改(尽管您仍然必须小心这一点)。
我知道这个问题很老,但我想要一个配置参数的答案,而不是解压的 WAR 解决方案。 配置解决方案是在WebAppProvider
中添加如下参数(在 8.1.8 中,这是在jetty-webapps.xml
):
<Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set>
以便整个配置文件读取如下内容:
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Ref id="DeploymentManager">
<Call id="webappprovider" name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="scanInterval">1</Set>
<Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
<Set name="extractWars">true</Set>
<Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.