views:

1074

answers:

2

The Web Start Developers Guide states

All application resources must be retrieved from the JAR files specified in the resources section of the JNLP file, or retrieved explicitly using an HTTP request to the Web server.

Storing resources in JAR files is recommended, since they will be cached on the local machine by Java Web Start.

Now, I have some resources I want to dynamically load after my application has been started (for example OSGi bundles). I can do this using plain HTTP, but I would like to make use of Web Start's support for local caching and versioned/architecture-specific resources.

Is there a way to download additional jar files from the original code base (as specified in the application's jnlp file) using the Web Start infrastructure?

Or alternatively: is there already an established way to integrate OSGi and Web Start that would relieve me of the task to install bundles from the Web Start server?

+3  A: 

If you make your application in itself an Equinox-based OSGI application, you can web-start it with all the addition bundles you need.

This article "WebStarting Equinox OSGi Apps" can give you a good introduction on the required settings.

  • All bundles have to be deployed as signed JAR files
  • You need a feature that contains all the necessary bundles
  • When exporting the feature, make sure that PDE creates a JNLP (Java Network Lauching Protocol) file (a checkbox in the export wizard) for this feature
  • Provide a root JNLP file for you application
  • Deploy your application to a web server and make sure that the web server is aware of the application/x-java-jnlp-file mime type

He also has an OSGI demo.

VonC
Aha! The article makes use of an "extension" tag in the JNLP file, something that was not mentioned in the Developers Guide. I'll see if I can make that work, too. Thanks.
Thilo
Found two points I do not like about this method: the bundles need to be known at startup time, and Web Start adds them to the boot classpath, from where Eclipse's WebStartMain seems to extract them and start them as bundles again. Still good to see that Eclipse already has this support built-in.
Thilo
The extension tag was afaik introduced with the Java 6 updating of Java Web Start. There was a lot of nice new features.
Thorbjørn Ravn Andersen
A: 

I havent tried it but look at the javax.jnlp.DownloadService API

l_39217_l