Java Web Start:如何让系统每次文件更改时都下载该文件
我刚刚实现了一个Java Web Start应用程序,在编程过程中我注意到一个问题:
如果我分发一个版本并使用JNLP文件下载它,我无法让系统再次下载文件,除非我添加/删除文件或从 Java 缓存中清除任务。这意味着如果我只是修改文件,系统将不会下载新文件:它只会使用旧文件。
我知道我可能可以禁止系统缓存文件,但是有没有更好的方法来更优雅地解决这个问题?
我还从 官方指南< /a>:
如果指定了允许脱机,Java Web Start 还将检查是否有可用更新。但是,如果应用程序已下载,则检查将在几秒钟后超时,在这种情况下,将启动缓存的应用程序。如果服务器连接速度合理,通常会运行应用程序的最新版本,但这并不能保证。不过,该应用程序可以离线运行。
这是否意味着,在实际应用中,如果网络速度较慢,最新版本无法运行的情况会经常发生?即,“相当快”有多快?
感谢您的所有投入!
I've just implemented a Java Web Start application, and I noticed one problem during the programming process:
If I distribute a version and use the JNLP file to download it, I cannot let the system to download the files again unless I add/delete files or clear the task from the Java cache. That means if I just modify the files the system will not download the new file: it will just use the old ones.
I know I probably can just forbid the system to cache the files, but is there a better way to solve this more elegantly?
Also I note this from the Official Guide:
If offline-allowed is specified, Java Web Start will also check to see if an update is available. However, if the application is already downloaded the check will timeout after a few seconds, in which case the cached application will be launched instead. Given a reasonable fast server connection, the lastest version of the application will usually be run, but it is not guaranteed. The application, however, can be run offline.
Does that means the situation in which the latest version will not be run will occur quite frequently in practice if the web is slow? I.e., how fast is "reasonably fast"?
Thanks for all the inputs!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 update 元素:
我不知道您在哪个版本的 java 下运行应用程序,但是 update 元素 是在 java 6 中引入的:
UPDATE 元素
You should use the update element:
I don't know under which version of java you're running your app, but the update element was introduced in java 6:
UPDATE Element