1

We got performance hit in one of the Java-Applet based web application. So we implemented JNLP concept to improve applet loading.

As per JNLP,

The JAR files will be downloaded to client machine for the first time and will be cached locally

If the applet version in the server matches the applet version in the cache, the applet will not be downloaded instead it will be loaded from the cache

If there is any change in JAR version in the server side, the old JAR in the cache will be replaced with the new JAR

But In our application, it is not working as expected. We found that the jnlp file itself is coming from cache hence it is containing the old jar version.

Is there any way that jnlp file alone should be freshly download everytime a browser is closed an opened? or is there any onther alternaive way to fix this?

Any help is much appreciated!!

JNLP File

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="" version="2.0.0.0">
    <information>
        <title>Active Viewer</title>
        <vendor>Platts</vendor>
        <offline-allowed/> 
    </information>
    <resources>
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="EWSApplet.jar" main="true" version="9.3.5.0" />
        <property name="jnlp.versionEnabled" value="true"/>
    </resources>
    <applet-desc name="EWSApplet"
                 main-class="com.mycompany.ew.applet.EWS_Config.EWS_Config.class"
                 width="1"
                 height="1">
    </applet-desc>
     <update check="background" policy="always"/>
</jnlp>
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Saravanan
  • 1,237
  • 2
  • 18
  • 25
  • How did you verify that the browser is caching? – PaulEdison Jul 22 '18 at 23:56
  • How did you verify that the browser is caching? I think Java (JRE) is doing the caching for the JNLP. Could you add the information what is changed in the JARs? is the Version as well changed? How did you verified that? – PaulEdison Jul 23 '18 at 00:04

2 Answers2

2

You could try to set the JNLP file to expire immediately in your browser, i.e. when downloading it set the corresponding headers like expires, cache-control, the no-cache pragma etc. (normally you need several for all the different browsers).

Thomas
  • 87,414
  • 12
  • 119
  • 157
  • I don't think that the JAR caching is done by the browser - as well as that would completely stop the caching - what could not be the goal (as there is the performance problem mentioned) – PaulEdison Jul 23 '18 at 00:09
1

i asume you download the jnlp file from some kind of webserver? If yes, then you should look closer to the website linking to the jnlp. Perhaps adding something like foobar.jnlp?version=xx.yy.zz can help. The ?version=xx.yy.zz will be handled as GET-Parameters by the server (and therefore ignored by file selection) but are not ignored by the browser while caching.

Greetings