|
Replies:
5
-
Last Post:
Dec 11, 2006 9:36 AM
by: mthornton
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
PHP and JNLP download
Posted:
Dec 10, 2006 3:25 AM
|
|
|
I recently acquired a little NAS device which also runs Apache and PHP. So I thought about hosting some WebStart applications on it. Like many cheap commercial services it doesn't allow much in the .htaccess file, and of course I can't use the JNLP download servlet as it doesn't run Java either.
I found some simple suggestions that allow the correct MIME type to be supplied by using a bit of PHP at the beginning of the JNLP file, but that doesn't supply a timestamp nor does it allow versioned downloads.
A few hours later and I have a PHP script which adds the timestamp, gives 304 responses if the client's file is already up to date, and can do versioned downloads (a bit more work needed on this bit). The current version also logs all the jnlp requests to a file on the web server.
Is anyone interested in this?
Incidentally this work was also prompted by some complaints that WebStart was slow to start. With my tests, using a versioned download, it isn't noticeably slower than starting a regular Java application of similar size.
Managing versioned jar files and jnlp files that reference them is a bit tedious. I have an ANT task that sets the version ids, renames the files as appropriate and fills in the attributes in the jnlp file. Now it is easy to let people continue using old versions. One JNLP file represents the current development, a release is achieved by merely copying that file to a new name which can then be used for as long as the jar versions it references are left on the server.
Mark Thornton mthornton@optrak.co.uk (Every spammer in the universe already has this address, but not many make it through my spam filtering!)
|
|
|
|
|
|
|
Re: PHP and JNLP download
Posted:
Dec 10, 2006 5:56 AM
in response to: mthornton
|
|
|
Mark,
This sounds very tempting. Hosting J2EE applications is somewhat expensive today, while Apache/PHP hosting is widespread and moderate. I'm very interested!
Alex
|
|
|
|
|
|
|
|
Re: PHP and JNLP download
Posted:
Dec 10, 2006 12:14 PM
in response to: alexter
|
|
|
I have applied to join the SwingLabs project and if accepted I will contribute the code there (LGPL licence).
|
|
|
|
|
|
|
|
Re: PHP and JNLP download
Posted:
Dec 11, 2006 7:01 AM
in response to: mthornton
|
|
|
Sounds great. If I could use the code I could spice up my cheap shared hosting with it. So please publish it.
|
|
|
|
|
|
|
|
|
|
Re: PHP and JNLP download
Posted:
Dec 11, 2006 9:36 AM
in response to: endolf
|
|
|
That doesn't do quite the same. He is processing the version id for an extension JNLP and then modifying the returned JNLP file to refer to the appropriate jar files. However the jar files are then obtained using the basic protocol not the versioned protocol. If you use versioned download throughout, checking if an app is upto date involves a single http request to see if the applications JNLP file has changed. By contrast, if any jar files are referenced without a version attribute, there will be an additional check for every such file. No big deal for a small demo with just one jar file, but as the application grows those extra checks become more irritating.
My code uses the same version naming convention for jar files as the JNLPDownloadServlet and resolves the desired version in the same way. That is it will accept requests for "1.2+" or even "1.3+ 1.2.4".
|
|
|
|
|