5 Replies Latest reply on Aug 31, 2011 3:36 PM by 885643

    DownloadServiceListener progress method not called when using Pack200


      I couldn't find a forum section for applets, so I post it here, although my application is not JavaFX, but an ordinary applet.

      I deploy it using JNLP:
      <jnlp href="myproject.jnlp" codebase="http://localhost:8080/myproject" spec="1.0+">
                <title>Some title</title>
                <j2se version="1.6+"></j2se>
                <property value="false" name="jnlp.packEnabled"></property>       <!-- pack200 enabled/disabled here -->
                <jar download="progress" href="loader.jar"></jar>
                <jar main="true" href="main.jar" size="423000"></jar>
                <jar main="false" href="other1.jar" size="9090000"></jar>
                <jar main="false" href="other2.jar" size="1168000"></jar>          
              <applet-desc width="800" height="480" main-class="org.apache.pivot.wtk.BrowserApplicationContext$HostApplet" progress-class="pl.MyDownloadServiceListener" name="MyApplet">
                <param value="pl.MyApplication" name="application_class_name"></param>
      The loader.jar holds a small set of classes for painting a custom progressbar:
      public class MyDownloadServiceListener implements DownloadServiceListener {
          ProgressView progressView = new ProgressView();
          public MyDownloadServiceListener(Object container) {
              createComponents((Container) container);
          public MyDownloadServiceListener(Object container, Object appletStub) {
              createComponents((Container) container);
          public void createComponents(Container container) {
              container.add(progressView, BorderLayout.CENTER);
          public void progress(URL url, String version, long readSoFar, long total, int overallPercent) {
              System.out.println("Called progress: " + url + ": " + readSoFar);
                      "Downloading application... (" + getDownloadedBytes() / 1024 +  " kB)",
          // other methods of the interface just System.out.println now .... 
      Everything works fine when the pack200 is disabled - the progress method gets called many times while the jars are downloaded from the server which makes the progress bar movement very smooth. However, when I enable pack200, Java doesn't call the progress method any more, although the jar.pack.gz files are downloaded correctly and the applet finally runs. However, calls to the validating method are still made (so my progress bar simply "jumps" after receiving a complete file). WTF? Can it be a bug in the current webstart implementation, or am I missing something? Is there any workaround other than not using pack200?

      Java version: 1.6.0 update 25
      Applet tested in Firefox 4.0.1.
      Adding/removing the size property of the resource jars in JNLP doesn't change anything. The webserver is reporting Content-Length correctly.
      The bug is present regardless jars are signed or not. Of course I test it on some remote server (with the codebase changed appropriately) so that downloading the jars takes about a minute.

      Edited by: 863702 on 2011-06-05 07:04

      Edited by: 863702 on 2011-06-05 07:05