You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Fung <fo...@qq.com> on 2016/08/26 04:58:26 UTC
How to set a virtual directory mapping
How to set a virtual directory that I can map a virtual path in my web-app to local physical path.
OS:window 7
Tomcat version:7.057
Re: How to set a virtual directory mapping
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Fung,
On 8/26/16 12:58 AM, Fung wrote:
> How to set a virtual directory that I can map a virtual path in my
> web-app to local physical path.
>
> OS:window 7 Tomcat version:7.057
So you want a physical path like D:\public\files to map-into your URL
space like http://example.com/myapp/files?
Try something like this in your META-INF/context.xml file:
<Context aliases="/files=D:/public/files">
...
</Context>
Ref: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
(search for "aliases").
If/when you upgrade to Tomcat 8, you'll want to replace "aliases" with
something like this:
<Context>
<Resources>
<PostResources
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/files"
base="D:/public/files" />
</Resources>
...
</Context>
Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJXwY8LAAoJEBzwKT+lPKRYL3QQAJSkTW7VfreoTCCKvSW7zsUo
/Z4afgsKZzNFt+ALnfGiDy/XpROelq02gy6Ai2rn73+gHc/tD38HVPzfNPyxQFeS
lhyFDPX9Lr5wPzbhLfm3WIthT5iS5E8s7ixsECnSRkYymYWWk34BSq3NJpHH0vuO
NmXgZ8VX/sbnN2l7+FrrVXdCmqqS9lOOV8UMGX1TRZzJhuZYrWQtDbrCR3WHcz7+
lN79aFrwM/SBM1eenYB8srx+vwC2GuKISH/5c0DC0UwycxxtCux/Uwvxo62IXmcW
Ee8ZQnxU/2ZmqwBTfjqaOHwLoR0VzuoTjL67uyV4mSoEqw6zqs3aRIH2Iw2Iuuvk
B2NWUtC6+sPuGlGKhOgIgwJbOMWpw6SpeivJ4cQxeOKeAQhKzBQEEuqNcT92yEFy
bbvwFzxgRJd7MEN0Ggit1tLrFLjHx9tlwbDNIbSjsDiQghVYr012beb6CgB7yBFV
KfEJkCCod4MJZqQuUTOke86PwaC6rV1Ep5wjxzsVMktqxh+Pp76q9/TujNsgMo5Q
wRwHEVuVFSCz1k2NxJgeryqlsOQanHZhFdYJU+SNzWYn9/hvBgQDoxByG7h0GYbT
R9PGtY8hOM/3vAAukOTn/IA0TBGXmcg0yc+gJFZPhZ/UB2cGQhKQoSJBQEv1Ga4g
3Y+E7NeZ9xsanoV8PPpy
=QSdB
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org