|
|
|
@ -65,6 +65,8 @@ import java.util.regex.Pattern;
|
|
|
|
|
@ControllerAdvice
|
|
|
|
|
public class GlobalController implements ErrorController {
|
|
|
|
|
|
|
|
|
|
@Value("${r'${server.servlet.context-path}'}")
|
|
|
|
|
private String context;
|
|
|
|
|
@Value("${r'${web.home.page}'}")
|
|
|
|
|
private String homePage;
|
|
|
|
|
@Value("${r'${web.login.page}'}")
|
|
|
|
@ -115,9 +117,10 @@ public class GlobalController implements ErrorController {
|
|
|
|
|
return "404";
|
|
|
|
|
case 403:
|
|
|
|
|
String errorUrl = RequestUtil.getErrorUrl(request);
|
|
|
|
|
errorUrl = errorUrl.replaceFirst(context, "");
|
|
|
|
|
if ((errorUrl.equals(homePage) || errorUrl.equals("/")) && LocalData.getToken() == null) {
|
|
|
|
|
try {
|
|
|
|
|
response.sendRedirect("/login.htm");
|
|
|
|
|
response.sendRedirect(context + loginPage);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|