You are here: Home » Reply

Reply To: A standalone Java client: FireflyClient



About applet configuration…

Hi everybody,

Here are details about the applet version of Firefly Client. First of all, to use applet version, you must use the version 0.9b of the client – (see previous post).

First, there are two main files :
– FireflyClient.jar which contains the applet binary
– fireflyclient.html which tells the browser to launch the applet with the following html code :

At applet launch, the Java plugin downloads the jar file and accesses it several times while applet is running. To avoid requesting the remote jar each time, the java plugin tries to put it in a cache. If the plugin is unable to cache it, the jar file will be downloaded each it is needed (i.e. several times per session) which is unusable.

How does java plugin caching mechanism work ?

For the java plugin being able to cache the jar file, it needs to receive the following HTTP response headers:
– Content-Length (the size of the jar in bytes)
– Last-modified (the last modified date of the remote file)
The plugin then puts the jar in cache, and works with the cached version until size has changed (Content-length) or modification date (Last-modified)
Normally, every web server sends those two headers when serving any file as soon as these informations are available (which is the case for any static file).
The problem is that the FireflyMediaServer (FMS) built-in web server doesn’t sends those headers for the files in the admin-root directory. This means that the java plugin is unable to cache the file which makes the applet unusable !

How to workaround these issues to have the applet working ?

First, the simplest way is to use the Java Runtime Environment (JRE) 1.6u10 (or more recent). Indeed, from this version, the java plugin interprets the ‘jnlp_href’ param name in the applet tag (see above). This parameter specify the url of a ‘jnlp’ file which is a more advanced descriptor (last generation) of the java applet. With the detailed informations contained in this description, the java plugin is able to cache the resources it needs (i.e. the jar file) without the usually needed HTTP headers and everything should work fine ! Keror0 has just said it worked for him (he runs the JRE 1.6 update 11).

The second way is a bit more tricky to get the applet working, but it should work for any version of java (> 1.4) like the firefly client non-applet version. The idea is to host the applet files on another webserver which should add the requested headers (Content-Length and Last-Modified) for the old versions of java plugin to cache the needed ressources. When running in that configuration you must add the FMS host and port as parameters of the applet tag :

<applet id="fireflyclient" style="width:100%; height:100%; position:absolute; top:0; left:0;"

Any classical webserver work for this (i.e. apache, lighttpd,….)

To summarize, instead of extracting the fireflyclient-applet[tar.gz|zip] file in the admin-root directory of FMS, extract it in the root of your dedicated webserver. Then edit the fireflyclient.html file to make the needed changes (comment out the first version of applet tag and uncomment the second one after having specified your FMS host and port in the applet tag params). The applet is now available at : http://your_webserver:your_webserver_port/applet/fireflyclient.html

What to do when replacing applet by a new version ?

You must purge the Java Plugin cache. To do that, open the Java Control Panel, click on the ‘Display’ button under the ‘Temporary Internet Files’ section and remove Firefly Client related file (especially FireflyClient.jar)

Authentication problematics ?
If you install the applet in the admin-root directory of FMS and the FMS admin pages are password-protected, you’ll have an authentication popup for accessing the page fireflyclient.html which might be annoying. The second kind of installation (on another webserver) remove this problem (Note that your library stays password protected (if configured) )

Hope this long post will help those who are interrested by the applet version of fireflyclient !

— caribou