From 1a9550e528bc66ce1783ec177575d6fae532f3e1 Mon Sep 17 00:00:00 2001 From: "peng.miao" <3453787934@qq.com> Date: Mon, 27 May 2024 16:14:26 +0800 Subject: [PATCH] =?UTF-8?q?CommonServletUtil.getRequest().getRequestURL()?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=B0=E7=9A=84=E8=AF=B7=E6=B1=82=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=BC=9A=E6=98=AF/error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaonuo/core/handler/GlobalErrorAttributesHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorAttributesHandler.java b/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorAttributesHandler.java index b4112725..0320a17a 100644 --- a/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorAttributesHandler.java +++ b/snowy-web-app/src/main/java/vip/xiaonuo/core/handler/GlobalErrorAttributesHandler.java @@ -41,10 +41,10 @@ public class GlobalErrorAttributesHandler extends DefaultErrorAttributes { // 获取其状态码 Object status = defaultErrorAttributes.get("status"); + Object path = defaultErrorAttributes.get("path"); if (ObjectUtil.isNotEmpty(status)) { // 如果其为404,则处理 if (HttpStatus.HTTP_NOT_FOUND == Convert.toInt(status)) { - Object path = defaultErrorAttributes.get("path"); if(ObjectUtil.isNotEmpty(path)) { return BeanUtil.beanToMap(CommonResult.get(HttpStatus.HTTP_NOT_FOUND, "路径不存在,请求地址:" + Convert.toStr(path), null)); @@ -53,7 +53,7 @@ public class GlobalErrorAttributesHandler extends DefaultErrorAttributes { } } else { return BeanUtil.beanToMap(CommonResult.get(HttpStatus.HTTP_INTERNAL_ERROR, "服务器异常,请求地址:" + - CommonServletUtil.getRequest().getRequestURL(), null)); + Convert.toStr(path), null)); } }