Wednesday, 19 August 2009

eXist and Jetty configuration

My initial experiments to get eXist installed and running as an AtomPub server went very smoothly.
But I've just spent a day thrashing around with the server configuration, trying to get it to serve static files from the Shuffl project test directory so that I can run tests more easily, without falling foul of the Javascript "same origin" restriction. This has been complicated by a number of factors:
  • Jetty is natively configured by Java object dependency injection, for which XML configuration files are a shim interface
  • the Jetty documentation isn't very approachable, especially as the XML configuration sections don't actually tell you how to configure the server - for that, you have to dig into the various servlet classes to understand the values that need to be injected
  • some configuration options can alternatively be applied through the servlet container configuration (web.xml), which is a completely different format
  • the eXist installation runs a specially tailored configuration of Jetty that doesn't immediately make it easy to find the configuration options
  • default security settings in Jetty do not permit following symbolic links when serving static files
Most of these are not necessarily bad things, but in combination they create a system whose configuration is about as user-friendly as a cornered rat. For me, the breakthrough came when I found a line in the eXist documentation "The Jetty configuration can be found in tools/jetty/etc/jetty.xml" (http://exist-db.org/deployment.html, section 3). This is relative to the eXist installation directory.
Editing this file, I can change (almost the last line in the file):
<Set class="org.mortbay.util.FileResource" name="checkAliases" type="boolean">true</Set>
to
<Set class="org.mortbay.util.FileResource" name="checkAliases" type="boolean">false</Set>
Now I can create a symbolic link shuffl in ${EXIST_HOME}/webapp, linking to my shuffl project directory, and by pointing my browser at http://localhost:8080/exist/shuffl/ I can browse my project directories and run the test files via eXist. Phew!

No comments:

Post a Comment