Skip welcomeServlet logic if requestTarget

does not resolve.
This commit is contained in:
Joakim Erdfelt 2022-10-17 15:21:04 -05:00
parent 1b790d51b4
commit 6ab8aa8d30
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 16 additions and 13 deletions

View File

@ -963,8 +963,10 @@ public class DefaultServlet extends HttpServlet
String requestTarget = isPathInfoOnly() ? request.getPathInfo() : coreRequest.getPathInContext();
Resource base = _baseResource.resolve(requestTarget);
String welcomeServlet = null;
Resource base = _baseResource.resolve(requestTarget);
if (base != null && base.exists())
{
for (String welcome : welcomes)
{
Resource welcomePath = base.resolve(welcome);
@ -981,6 +983,7 @@ public class DefaultServlet extends HttpServlet
welcomeServlet = welcomeInContext;
}
}
}
return welcomeServlet;
}