Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: How do you do virtual directory / path mapping in a webapp

Tim Funk

2007-01-10

Replies:

There is no way currently. I have a patch on my local machine which
allows add this functionality for FileDirContext.
http://tomcat.apache.org/tomcat-5.5-doc/config/resources.html

<Context path="/x"
    docBase="/usr/local/crap">
<Resources className="org.apache.naming.resources.FileDirContext"
       aliases="/a1=/mypath/images;/a2=/foopath/images" />
</Context>

But I haven't had time to see if my patch is secure or compliant if
someone uses the WebDav servlet.

In the meantime - your best alternative is to use sym links.

-Tim

Barrie Selack wrote:
> I am converting from Resin and there I can map a directory not inside
> the webapp to one which can be reached via a URL and translated by Resin
> as below:
>
>  <path-mapping>
>   <url-pattern>/files/*</url-pattern>
>   <real-path>/realdir/files</real-path>
>  </path-mapping>
>
> I can't seem to find a way in Tomcat to do that. Do I have to write my
> own filter? Any tips or help appreciated.
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.