From af2f0cc50f22ec9fc6632dc4ed405825b9a99211 Mon Sep 17 00:00:00 2001 From: zhengjw22 Date: Thu, 14 Nov 2024 17:24:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96url=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/tech/smartboot/servlet/DefaultServlet.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 d2284d3..4cd8936 100644 --- a/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java +++ b/servlet-core/src/main/java/tech/smartboot/servlet/DefaultServlet.java @@ -238,8 +238,7 @@ private boolean matchForwardWelcome(HttpServletRequest request, HttpServletRespo if (deploymentInfo.getWelcomeFiles().stream().anyMatch(requestUri::endsWith) || requestUri.indexOf(".") > 0) { return false; } - - response.sendRedirect(requestUri + "/"); + request.getRequestDispatcher(requestUri.substring(request.getContextPath().length()) + "/").forward(request, response); return true; }