A filter works like a charm. However it seems the requirments have changed a little and this functionality needs to be available at any point during runtime.
So I am going to move the logic into the doGet of a servlet that can be called when required. My concern now are resources (the index files) being released in time for other components to work with them.
But the issue I originally created this
thread for has been resolved.
Thanks Bear.