|
So, you've gone to the trouble of providing a webstart extension for the library you're producing. People start using it, great news! However, you need to make changes to the library that would break existing users - of course you want the thing to be versions so Joe Bloggs and his mates can refer to version 0.1 and you can carry on distributing the latest version seperately. Webstart extensions let you do this! However, theres very little documentation on how you use extensions let alone how you version them. There is a Servlet provided if you feel like running tomcat just so you can distribute your library in a controlled manner. Slick has this issue, so I've done my best to work round it. Here's how: First, at the prompting of some IRC suggestions, I use the .htaccess file to redirect my slick.jnlp extension descriptor to a php script that's going to generate the versioned contents: Redirect /demos/slick.jnlp http://slick.cokeandcode.com/demos/slick-ext.php The PHP script has a few elements. First it starts with this block: <?php
$version = $_GET["version-id"];
header("x-java-jnlp-version-id: ".$version);
header("Content-type: application/x-java-jnlp-file");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
if (($version == "unstable") || ($version == "")) {
$version = "";
} else {
$version = "-".$version;
}
?>When webstart makes a requested for a versioned resource (be in JNLP or JAR) it specifies the version in the version-id http attribute. This was determined by dumping out the contents of $_GET in a test script. Next, reading around the docs for that Servlet it mentions that the version ID must be returned in a headed named x-java-jnlp-version-id. So next, that gets stuck in the header. Then the normal bit, set the content type up for JNLP and dump out that XML versioning line which will crap out PHP if it's the main text. The last piece is specific for slick but essentially I'm versioning my jars by keeping a local copy suffixed with a dash and then the version identifier. If no version is specified or the "unstable" version is requested then I just want to get the bog standard slick.jar, otherwise grab me the slick-0.x.jar. The last bit of substitution is later in the JNLP file where the resources are specified and looks like this:
<?php
echo '<jar href="slick'.$version.'.jar"/>';
?>
So this just changes the JNLP based on what version was passed. The script could of course reference what ever is likes, use a database or whatever to determine the versions of the different jars that build up a particular extension version - or go one stage version and version the jars based on the extension version ---- oooer. Looking back over it now it all seems pretty simple, but without documentation it's a pain. Feel free to take a look at the full extension file if needs be. |
DisclaimerNote that the views on this page are not intended to offend. If they do, you might be taking the content too seriously.
Twitter Updates
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 2D OpenGL Based Game Library ![]() 2D Game Physics Engine in Java Game Developers How about a list of the developers doing interesting things in java gaming. Game Dev Resources Looking for Game Development Resources? Check out the List! |