Adding in-code comments about WebAppContext.getWebInf behavior

This commit is contained in:
Joakim Erdfelt 2022-08-10 12:59:29 -05:00
parent 199a9cd2ad
commit 0023281e3f
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
2 changed files with 11 additions and 5 deletions

View File

@ -809,13 +809,15 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
if (getResourceBase() == null)
return null;
// Iw there a WEB-INF directory?
Resource webInf = getResourceBase().resolve("WEB-INF/"); // TODO: what does this do in a collection?
// Is there a WEB-INF directory anywhere in the Resource Base?
// ResourceBase could be a ResourceCollection
// The result could be a ResourceCollection with multiple WEB-INF directories
// Can return from WEB-INF/lib/foo.jar!/WEB-INF
// Can also never return from a META-INF/versions/#/WEB-INF location
Resource webInf = getResourceBase().resolve("WEB-INF/");
if (!webInf.exists() || !webInf.isDirectory())
return null;
// TODO: should never return from WEB-INF/lib/foo.jar!/WEB-INF
// TODO: should also never return from a META-INF/versions/#/WEB-INF location
return webInf;
}

View File

@ -811,7 +811,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
if (super.getBaseResource() == null)
return null;
// Iw there a WEB-INF directory?
// Is there a WEB-INF directory anywhere in the Resource Base?
// ResourceBase could be a ResourceCollection
// The result could be a ResourceCollection with multiple WEB-INF directories
// Can return from WEB-INF/lib/foo.jar!/WEB-INF
// Can also never return from a META-INF/versions/#/WEB-INF location
Resource webInf = super.getBaseResource().resolve("WEB-INF/");
if (!webInf.exists() || !webInf.isDirectory())
return null;