tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Making PreResources configuration recurse directories
Date Wed, 05 Jun 2019 20:36:38 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Theodore,

On 6/5/19 15:16, Milbaugh, Theodore K (Ted) wrote:
> I am using Tomcat version 9.0.12
> 
> I have a PreResources tag in my context.xml like this:
> 
> <Resources
> className="org.apache.catalina.webresources.StandardRoot"> 
> <PreResources 
> className="org.apache.catalina.webresources.DirResourceSet" 
> base="C:\\good_files\\goodies_in_here" internalPath="/" 
> webAppMount="/" /> </Resources>
> 
> This works great, in that if I access a JSP like this:
> 
> http://localhost:8080/candy/chocolate.jsp
> 
> I am able to access the JSP with no issues. However, there are
> subdirectories in C:\good_files\goodies_in_here. If I try to access
> a JSP in a subdirectory:
> 
> http://localhost:8080/candy/crunchy/peanut_brittle.jsp
> 
> I get a 404, even though the file
> C:\good_files\goodies_in_here\crunchy\ peanut_brittle.jsp exists.
> Do I have to create a PreResources tag for each subdirectory in my
> tree?

What you are doing is expected to work. It doesn't map a single
directory and its (non-directory) contents into a single directory. It
grafts entire trees into the URL space.

It may be a copy/paste error, but I see a space between your
"crunchy/" and "peanut_brittle.jsp" strings. It should not matter, but
if you replace "\\" in your configuration with "/", does that improve
things?

I would caution you about the use of <PreResources>. If there is for
example a WEB-INF/web.xml file in there or WEB-INF/classes, then those
will be loaded before the web application's "normal" files are loaded,
which may be surprising.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlz4J9YACgkQHPApP6U8
pFirEhAAjXYPtNpJV0VKZDvJtL4qCoieJsBBp9sy59M3SEZbiVhhdjc3ywTaXoy2
1lfNVFUtpt0QJCmyYLVgreeegvNx1Jpi+oHXlD0Xo2UaGJ5Dfbeaf4rBRSwm5oUy
CL4ui0L1VvT2aqyiYyjGSOED1bBOSHwzrys9itFHiOviVnwbAk0S3rm598ot1nrQ
Rr2IMW3lirtccTu2xvQ8cc7lNuidQ9d/b/AM13pjXtOs95nt+wFuyTO9RFAjrpAq
l2Qu2VRqgAvywEhbLBCXEH4KVPPPuIxqprkuvdHYC5s8TYzmYGFRmVLGFVTcd1vu
korRGug90lATcFRYhKtsx+NMEad9U9z3mNIxpEaQmC+lLp2NUyiGl3IBoldIKA/y
GhkGPVMysthsFJnFp4KguRJSKAdelSmlbLmWdp2bB/xKPor0s0virY5ZfYLHaDEU
taiAIkTItOi1B67qAfwxDWATs0emorRgXdGCSWbrvY3q0wM7mpU35oSaINQXiRfv
nItLDenEeXkUP+A8RU8pHQ9OcOuBTuGERZD+riDdgXxjHK3XIcQSRtWsLqHLtH0G
Eq1FxNxOSPfD1G+F6oqc5aj6REOWlIqDN5s0OtQc4xQ8N6nhlBp+hLb2ZiXHhU/v
0UMYHuGyG0pawpaMQL2D/yKA92F3f+OJrLWdbbm8Zm6p6Bfsl7s=
=5njw
-----END PGP SIGNATURE-----

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


Mime
View raw message