diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java b/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java index a3c4d8b..9dd863c 100644 --- a/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java +++ b/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java @@ -238,10 +238,14 @@ private boolean matchForwardWelcome(HttpServletRequest request, HttpServletRespo if (deploymentInfo.getWelcomeFiles().stream().anyMatch(requestUri::endsWith) || requestUri.indexOf(".") > 0) { return false; } - if (requestUri.equals(request.getContextPath())) { + URL url = servletContext.getResource(requestUri.substring(request.getContextPath().length()) + "/"); + if (url != null) { response.sendRedirect(requestUri + "/"); +// request.getRequestDispatcher(requestUri.substring(request.getContextPath().length()) + "/").forward(request, response); return true; } +// URL url = servletContext.getResource(requestUri.substring(request.getContextPath().length()) + "/"); + return false; }