JNLP does not auto updating JAR file

泄露秘密 提交于 2019-12-13 05:15:31

问题


I am working in a such environment, where we have to update client jar in every 2 months maximum. So, as a solution I am suggesting to use JNLP by using this approach we do not have to worry that every user is using the latest release or not. As, There are more then 100 clients per department.

But the problem is JNLP isn't upgrade the new jar file in the following is the my.jnlp file

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://192.168.1.26:8080/" href="Test.jnlp">
<information>
    <title>HC</title>
    <vendor>DRL</vendor>
    <homepage href="http://192.168.1.26:8080/" />
    <description>DRL</description>
    <offline-allowed/>
</information>
<security>
    <all-permissions/>
</security>
<resources>
    <j2se version="1.6+" />
    <jar href="JnlpTest.jar" download="eager" />
</resources>
<application-desc 
    name="HC-DRL"
    main-class="com.drl.simap.client.module.ui.Splash" />
</jnlp>

My working environment: Tomcat-6.0 server and following tutorial here


回答1:


If you download the jnlp spec and look at chapter 6, there is a whole section about caching: "6 Downloading and Caching of Resources"

You can try to add a version number to your jar file and then use the jnlp jar version attribute.

If you currently don't do that, the spec states the following:

An entry downloaded using the basic download protocol must be located in the cache based on the URL. The time stamp obtained from the HTTP GET request in the Last-Modified header field of the reply should be stored along with the downloaded resource. The time stamp is used to determine if the copy on the server is newer.

The JNLP Client cannot assume that the HTTP GET request will return the same JAR file for each request. The JNLP Client must periodically check the Web server to see if an updated version is available. This check is recommended to be performed before an application is launched, but the exact algorithm used by a JNLP Client depends on the particular implementation. For example, if a JNLP Client is offline, the check is not required to be performed.

The above caching rules also apply to extension descriptors downloaded using the extension download protocol where the version attribute is not specified.



来源:https://stackoverflow.com/questions/19064634/jnlp-does-not-auto-updating-jar-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!