Tag Archives: Static Content

Configuring Links to data files in the BII web app in JBoss 5.x

We have been getting asked a lot about general deployment within the ISA tools suite, particularly with respect to the web application, which can look a little complex. Here I’m going to describe one of the more perplexing tasks when setting up JBoss: how do I configure JBoss to serve up static content, i.e. my data files. I will also cover how to set up the URLs in data-locations.xml (for the BII Manager tool) to automatically place your files in this directory.

Setting up JBoss to serve out files

Probably the most annoying part of setting up JBoss is telling JBoss to serve out your data files from the web application. For instance, the BII data manager tool has sent the files to /tmp/data/bii/ on my file system and I want the URL http://localhost/data to point to that directory. There are a number of ways you can do this. You can use Apache or nginx to do this, you could change your data directory to be within the ROOT.war directory in your JBoss server directory, or you could do what I’m suggesting here and do everything through JBoss…which I think is a bit cleaner, and not so difficult when you know how.

1. The first thing to do is modify the profile.xml file found under the server/default/config/bootstrap folder in your JBoss installation.

Image

In profile.xml, there is a bean named BootstrapProfileFactory, you need to modify this and add a value element to the java.net.URI list element. Here, I’ve added a path to my Downloads directory.

Image

2. Next, we need to set up a folder in my Downloads directory, which has to have a series of folders following the deploy pattern of  /server/<profile>/deploy/ – so now, the directory /Users/eamonnmaguire/Downloads/server/default/deploy/ should exist

3. Within the deploy directory, create a data.war directory, and inside that create a WEB-INF directory. The name of the .war directory will dictate the URL, so data.war will correspond to http://localhost/data. In the WEB-INF directory, create an empty web.xml file. It’s contents will be <web-app></web-app> – Under the /Users/eamonnmaguire/Downloads/server/ I now have the following directory structure.

Image

4. Add your files

Finally, within your data.war directory, add the files you want to display. Here I’ve added a PDF for simplicity.

Image

Start up JBoss running ./run.sh -c default and navigate your browser to http://localhost:8080/data/Diagnosis.pdf and I get this lovely page.

Image

That’s it!

Now, to configure data-locations.xml. For out ISA-Tab for example, we simply set up the filesystem_path to be where, on our machine we want the files to be distributed. The web_url will be the URL we’ve just configured that has mapped data to that actual position in the file system.

Image