My app is deployed by JavaWS but after the user clicks on the JNLP there is a long pause where nothing seemingly happens, then the app pops up on the screen. JavaWS is downloading all the JARs in the background but there is no progress indication, which is very poor. So I set about building a custom one:
public class LoadingProgress implements DownloadServiceListener
{
Stage stage;
TextArea log = new TextArea();
public LoadingProgress()
{
stage = new Stage(StageStyle.UNDECORATED);
stage.setScene(new Scene(PaneBuilder.create().children(log).prefHeight(300).prefWidth(300).build()));
stage.show();
}
@Override
public void downloadFailed(URL url, String version)
{
log.appendText(String.format("failed url=%s version=%s\n", url, version));
}
@Override
public void progress(URL url, String version, long readSoFar, long total, int overallPercent)
{
log.appendText(String.format("progress url=%s version=%s readSoFar=%d total=%d overallPercent=%d\n", url, version, readSoFar, total, overallPercent));
}
@Override
public void upgradingArchive(URL url, String version, int patchPercent, int overallPercent)
{
log.appendText(String.format("validating url=%s version=%s patchPercent=%d overallPercent=%d\n", url, version, patchPercent, overallPercent));
}
@Override
public void validating(URL url, String version, long entry, long total, int overallPercent)
{
log.appendText(String.format("validating url=%s version=%s entry=%d total=%d overallPercent=%d\n", url, version, entry, total, overallPercent));
}
}
And here is my JNLP below. You will notice I tried using the custom loader class in three different ways none of which work on their own or put together:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="6.0+" codebase="${url}" xmlns:jfx="http://javafx.com" href="Companyapp.jnlp">
<information>
... info ...
</information>
<update check="always" policy="prompt-update" />
<security>
<all-permissions />
</security>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp" />
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
... jar assets ...
</resources>
<jfx:javafx-desc main-class="com.mediacitizens.companyapp.presentation.desktop.Main" name="Companyapp" progress-class="com.mediacitizens.companyapp.presentation.desktop.LoadingProgress" /> <!-- width="0" height="0" //-->
<application-desc main-class="com.mediacitizens.companyapp.presentation.desktop.Main" progress-class="com.mediacitizens.companyapp.presentation.desktop.LoadingProgress" />
<component-desc progress-class="com.mediacitizens.companyapp.presentation.desktop.LoadingProgress" />
</jnlp>
So none of this makes any difference. Nothing interesting is printed to console either, even with full logging + tracing.
What is going on?