Former-commit-id: 52c4e79ce68c7daec42b0785ae79e187d23572e9
master
wangbing 5 years ago
parent c9334902f2
commit ce38ef58f6

@ -33,6 +33,7 @@ import ${basePackage}.frame.utils.AESUtil;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.utils.MD5Util;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.RequestUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -113,7 +114,8 @@ public class GlobalController implements ErrorController {
case 404:
return "404";
case 403:
if ((request.getServletPath().equals(homePage) || request.getServletPath().equals("/")) && LocalData.getToken() == null) {
String errorUrl = RequestUtil.getErrorUrl(request);
if ((errorUrl.equals(homePage) || errorUrl.equals("/")) && LocalData.getToken() == null) {
try {
response.sendRedirect("/login.htm");
} catch (IOException e) {

@ -56,11 +56,24 @@ public class RequestUtil {
/**
*
*
* @param request
* @return
* @param request
* @return
*/
public static String getUserAgent(HttpServletRequest request) {
return request.getHeader("User-Agent");
}
/**
* URL
*
* @param request
* @return URL
*/
public static String getErrorUrl(HttpServletRequest request) {
if (request.getAttribute("javax.servlet.error.request_uri") != null) {
return (String) request.getAttribute("javax.servlet.error.request_uri");
} else {
return "";
}
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.