incubator-jspwiki-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Burch <br...@PingToo.com>
Subject Displaying images outside the webapp container
Date Thu, 04 Dec 2008 22:18:36 GMT
I am running jspWiki 2.8.1 under tomcat 5.5.27, on an ubuntu linux system.

I have successfully used the ImpagePlugin and SlideShowPlugin to display 
digital photos WITHIN the webapp directory path. I think I understand 
how they generate inline url's within the web page, so that the browser 
issues an HTTP GET for the individual image files. This means that 
tomcat, not jspWiki, will be responsible for delivering the individual 
image files.

I have LOADS of photo's in a directory hierarchy which is outside the 
tomcat directory structure. I don't want to move this huge hierarchy 
inside the jspWiki container because it simply isn't the right place for it.

I've created a symlink for the root of my photos directory, e.g.

ln -s /real/path/to/my/photos/ /tomcat-home/webapps/wiki/files/photos

My photos can be found with system commands, e.g. both

ls -l /real/path/to/my/photos/2008/November/DSCF0123.JPG
ls -l /tomcat-home/webapps/wiki/files/photos/2008/November/DSCF0123.JPG

work fine.

However, when my wiki page uses either plugin with 
src='files/photos/2008/November/DSCF0123.JPG,
the image file is not displayed. When I view the page source, the url 
for the <img> src url appears to be fine.

This a known tomcat issue - that it will not follow a symlinked 
directory by default. 
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
says to define a context.xml in the webapp META-INF directory. Mine 
simply contains <context allowLinking="true"/>, because the 
documentation recommends NOT specifying docBase.

The tomcat log says:

INFO: default: DefaultServlet.serveResource:  Serving resource 
'/files/pictures/2008/11-lateAutumn/DSCF2686.JPG' headers and data

This looks suspicious to me - the url has a leading slash, rather than 
relative to the webapp docBase, and tomcat doesn't serve up the image 
file! Presumably, I've missed an important detail.

Any quick words of wisdom would be appreciated.

Brian

Mime
View raw message