Friday 6 May 05
Making good progress in making the installation much easy, though it’s a bit slow going! I’ve moved all the config/xsl etc files to within the .war file. Then I could access these files by using the following:
-
Declare a ServletContext
private ServletContext context;
-
Alter the init() method of the servlet so it’s like this:
public void init(ServletConfig config) throws ServletException {
context = config.getServletContext();
// other stuff
}
- Then you can refer to the files in the .wzr as follows:
InputStream myStream = context.getResourceAsStream(“xsl/myfile.xsl”);
The only part I had trouble with was when one of the xsl files used another xsl file as an include. If I hardcoded the full url to the xsl then is worked fine, but as soons as I tried to just use a relative url it all failed, just got a transformation exception (“Had IO Exception with the stylesheet file?”).
The solution to this was to create a URLResolver class (or a bit of looking around on the internet to find one someone else has already done or being emaied one!), then before running the transformation set the URIResolver:
tFactory.setURIResolver(new RenderResolver(renderContext.getRealPath(“/config/xsl/”) + “\\”));
The examples I originally found on the internet didn’t seem to have the +”\\” added in (for the file/directory seperator), so it didn’t work, but as soon as this was suggested to me and I added it in, everything was working fine
Much of this progress is thanks to the help & suggestions from Paul Sharples (Reload developer)
I hope to have the next version of the player available sometime next week….










