码头-设置系统属性 [英] Jetty - set system property

查看:79
本文介绍了码头-设置系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jetty上运行webapp.该应用程序的配置来自运行Jetty的同一服务器上的文件.在应用程序内部,我依靠system属性获取文件的路径,以便我可以对其进行解析.例如

I run webapp on Jetty. The configuration for the app come from file that lives on the same server where Jetty is running. Inside the app I rely on the system property to obtain path to the file so I can parse it. E.g.

final String loc = System.getProperty(FACTORY);

现在,我可以使用D开关启动码头,在命令行上提供 $ FACTORY ,但我会尽可能地将其放置在jetty.xml中.我知道有< SystemProperty/> 标记,但这似乎只是提供< Set/> 标记已经存在的系统值.有人可以举例说明如何实现吗?(如果可以实现的话)

Now I can start jetty with D switch to provide $FACTORY on the command line but I rather put it in jetty.xml if I can. I know there is <SystemProperty /> tag but that seems to just provide system value that already exists for the <Set/> tag. Can someone give me example how this can be achieved? (If it can be achieved)

推荐答案

要配置Web应用程序,最好避免使用系统属性,而改用JNDI.

To configure a web application it is better to avoid system properties and to use JNDI instead.

最近,我发布了一个示例关于如何使用Jetty做到这一点.

Recently I posted an example on how to accomplish that with Jetty.

这篇关于码头-设置系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆