首页 文章

JNLP文件自动更新问题

提问于
浏览
1

我有一个基于jws的应用程序 .
它部署在Web服务器上,客户端从浏览器下载文件并运行它 .
这会创建 desktop shortcut 并且应用程序运行完美 .

现在,如果我在服务器上的jnlp文件中更改某些 properties ,然后从桌面快捷方式或从下载的jnlp文件本身运行已安装的应用程序(在客户端计算机上), it doesn't gets updated .

我已在jdk版本 1_6_30 and 1_7_21 上验证了这一点 . 这两个版本似乎解决了与缓存路径中的空格相关的前一个bug .
问题仍然存在于Windows XP / 7/8上 .

原始的jnlp文件:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="path/to/fileLocation" spec="1.0+" href="demo.jnlp" >

<information>
 .
 .
 .
 <offline-allowed/>
  <shortcut online="false">
          <desktop/>
          <menu submenu="Demo"/>
  </shortcut>
</information>
<update check="always" policy="always"/>
<!--request all permissions from the application. This does not change-->
<security>
  <all-permissions/>
</security>
.
.
<resources>
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
<extension> 
    name="Wrapper feature"
    href="plugin_<some_random_generated_string_1>.jnlp"/>
</extension>
</resources>
.
.
.
<resources os="Windows" arch="x86">
         <j2se version="1.6+"  java-vm-args="-Xms400m -Xmx800m"/>
</resources>

更新了jnlp文件:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="path/to/fileLocation" spec="1.0+" href="demo.jnlp" >

<information>
 .
 .
 .
 <offline-allowed/>
  <shortcut online="false">
          <desktop/>
          <menu submenu="Demo"/>
  </shortcut>
</information>
<update check="always" policy="always"/>
<!--request all permissions from the application. This does not change-->
<security>
  <all-permissions/>
</security>
.
.
<resources>
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
<extension> 
    name="Wrapper feature"
    href="plugin_<some_random_generated_string_2>.jnlp"/>
</extension>
</resources>
.
.
<resources os="Windows" arch="x86">
          <j2se version="1.6+"  java-vm-args="-Xms300m -Xmx600m"/>
</resources>

java-vm-args 的变化没有反映出来 .
如果我重新下载jnlp文件然后从中运行,则更新有效 . 在这种情况下,桌面快捷方式仍然是指旧的痛苦:(

使用JaNeLa验证了jnlp .

编辑:

这个demo.jnlp还包括另一个功能jnlp(在blockquotes中添加),其中包括应用程序所需的所有jar . 因为在每次更新应用程序时,此功能jnlp也会更新,但不会在客户端上反映出来 .

1 回答

  • 2

    JWS一直擅长更新Jars,但是在更新JNLP文件时也是如此 . 动态生成的JNLP通常缺少 href 属性,以指示插件不创建桌面快捷方式 .

    另一方面,可以在IntegrationService of the JNLP API中找到解决方法 . 你可能会:

    • 缓存 PersistenceService 中最后一个已知JNLP的副本 .

    • 在app . 启动,连接回服务器并显式读取JNLP .

    • 将其与缓存版本进行比较 .

    • 如果已更改,请卸载桌面快捷方式并重新启动应用程序 .

    • 如果没有更改, and no desktop shortcut exists, 提示安装(新)桌面快捷方式 .

    如果服务器返回有效的“上次更新”时间,则可以通过简单检查JNLP的URL连接的标头来替换步骤2和3 .

相关问题