I'm running Tomcat 7.0.42 under OpenJDK 7 on ubuntu linux 13.10, but I
don't think this information is particularly relevant to my question.
I currently have a servlet that relies on the standard Default Servlet
to handle its static content. Specifically, the webapp is apache jspwiki
and my code runs as one of its plugins.
My plugin runs as part of the jspwiki servlet and automatically
generates url's, both to other wiki pages and also to static content.
All of these urls are relative to the webapp base, so the Default
Servlet has no problem serving up the static content (actually a tree
structure of directories and image files).
In all non-trivial use-cases, these image files will reside outside the
deployment directory of the webapp. At the moment I solve this problem
as follows:
1. tomcat runs as a regular non-root user.
2. the static image files belong to a different non-root user.
3. the static image directories and files belong to a special group that
has only read access (and execute access for directories).
4. the tomcat user is a member of this group.
5. The deployed webapp (unpacked war) is manually injected with a
symlink to the real root directory so that the static content "appears"
to be within the webapp. This enables the Default Servlet to read and
the serve up those resources when requested.
My solution works well, but it isn't satisfactory because it requires
"war surgery" on jspwiki. I would like to find a more elegant solution,
but I don't want to reinvent the Default Servlet when it already does
the job well enough for my needs.
The Default Servlet seems to be a global resource, with its
configuration in $CATALINA_BASE/conf/web.xml and its scope of control
covering all Containers for requests that don't explicitly match a url.
[incidentally, my $CATALINA_BASE/conf/web.xml has listings == false]
I don't think it would help to add a docBase in my context.xml, pointing
to the external images, because the majority of the resources are
deployed and accessed conventionally from within the deployed webapp
directory.
Have I overlooked a configuration trick that would allow me to use the
webapp without a symlink, but still have the Default Servlet access
external static content as if it were internal?
Regards,
Brian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org