You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ken Johanson <to...@kensystem.com> on 2009/01/27 20:26:30 UTC

Virtual dirs without new context?

Hi all,

I know from reading that if one wants to create a a virtual directory 
(one that does not physically exist in the host's appbase but is 
accessible via a configured mapping), that the traditional suggestion is 
to create a new context in the host.

However, I'd like to create one or more virtual dirs (e.g. without 
needing a to define new contexts, for each vhost):

-Defining contexts uses additional memory, requires separate WEB-INF, 
class,lib etc per context, and creates RequestDispatcher, classloader 
and privilege concerns.
-If 10s or 100s of hosts, it may be preferable to define at a higher 
scope, say, Engine.

Hypothetically this might look like:

<VirtualDir path="/webmail" realPath="/somedir/" />

.. and might be declarable both in Engine or in Host. If the dir 
contains JSP code, it is expected it would compile/bind against the 
current Context's classloader libs. And it would use the same/single 
config from the existsing WEB-INF.

Basically I can get the effect I'm after, but not in a portable way, by 
creating symlinks and allowLinking="true" on the Context, which is also 
a security risk (a# enabling symlinks and b# allowing file-level access 
to the symlink contents).

I imagine I could also do this using a Filter, but again would prefer 
not use this approach either to keep the call stack short, and for not 
wanting to roll my own if another solution exists.

Is there a best-practice for this?

Thanks in aadvvance,

-ken



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org