From 7df57dc07b6edd9446f5f53ee0a8ad6d7e6363a5 Mon Sep 17 00:00:00 2001
From: Jayden <renjie@bluedeer.com.cn>
Date: 星期日, 18 七月 2021 18:53:04 +0800
Subject: [PATCH] 暂存

---
 src/main/java/cn/org/xinke/annotation/LoginAspect.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/main/java/cn/org/xinke/annotation/LoginAspect.java b/src/main/java/cn/org/xinke/annotation/LoginAspect.java
index 43bad3c..eb934b8 100644
--- a/src/main/java/cn/org/xinke/annotation/LoginAspect.java
+++ b/src/main/java/cn/org/xinke/annotation/LoginAspect.java
@@ -31,7 +31,7 @@
         // 鐧诲綍璁よ瘉
         User loginUser = (User) request.getSession().getAttribute( "LOGIN_USER" );
         if (loginUser == null) {
-            response.sendRedirect( "/login.html" );
+            response.sendRedirect( loadContextPath(request) + "/login.html" );
         }
         try {
             return pjp.proceed();
@@ -39,4 +39,12 @@
             throw throwable;
         }
     }
+    
+    public String loadContextPath(HttpServletRequest request) {
+    	String contextPath = request.getContextPath();
+    	if(contextPath.equals("/")) {
+    		contextPath = "";
+    	}
+    	return contextPath;
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0