Brian Burch wrote:
The DefaultServlet logs that it has inserted a leading forward slash,
but I now think this is misleading.
I created two folders side by side. files/pictures/ is a symlink and
files/pictures-local/ is a real folder. View source for both image urls
is equivalent (both without leading slash), and the DefaultServlet log
entries are also equivalent (both with leading slash). The only
difference is that the non-symlink image displays while the symlink one
does not.
I think the most likely explanation is that my META-INF/context.xml is
applied to the jspWiki webapp, but tomcat is scheduling the
DefaultServlet to find the image. If I am right, I will need to apply
allowLinking to the DefaultServlet, or possibly the entire tomcat Host.
My deduction was not correct. The DefaultServlet is running in the
context of the jspWiki webapp, which is why it is able to find and
deliver the files/pictures-local/ image.
This meant it was not finding the symlinked image because my
META-INF/context.xml file was being ignored.
I read the tomcat docs again. My Host is configured to auto-deploy its
webapps. Auto-deployment uses the $CATALINA_HOME/conf/context.xml file
and so I presume the META-INF/context.xml file is never processed, or is
too late because the Context is already created.
I added allowLinking="true" to the auto-deploy context and MY SYMLINKED
IMAGE DISPLAYED!
The only problem is that every other webapp under the same Host will now
be allowed to follow symlinks, so I need to work out how to restrict the
permission to only jspWiki.
Once I have sorted out the details, I will transfer this knowledge to
the wiki for anyone else who wants to do the same thing.
Brian