为 Java Web Start 应用程序动态生成 JNLP 文件?

为 Java Web Start 应用程序动态生成 JNLP 文件?

问题描述:

我正在编写一个 servlet 来返回一个 JNLP 文件,其中包含要传递给 Web 启动程序的几个动态生成的参数.现在我的代码使用股票模板和令牌替换,但我必须认为有一种方法可以在 servlet 中以编程方式生成此文件.

I'm writing a servlet to return a JNLP file with several dynamically generated parameters to be passed to a web start program. Right now my code uses a stock template and token replacement, but I have to think there is a way to generate this file programmaticly within a servlet.

是否有任何可用的工具?

Are there any tools available for this?

它只是一个 XML 文件,所以我认为有多种方法可以做到这一点,从您的令牌替换想法到像 freemarker 这样的完整模板语言,或使用程序化 DOM 生成.它似乎不够复杂,不足以保证有自己的专用 API.

It's just an XML file, so I'd have thought there are various ways to do this, from your token-replace idea to a full template language like freemarker, or using programmatic DOM generation. It's doesn't seem complex enough to warrant a dedicated API of its own.