From 0cac241cfa9c9533a2fa6ad432097c10198a6b46 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 1 Jun 2023 15:41:46 +0900 Subject: [PATCH] =?UTF-8?q?accessInitializer=20->=20@Component,=20Exceptio?= =?UTF-8?q?nController#invalidSession(...)=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 20 +++++++++++++++++++ .../xit/foundation/web/AccessInitializer.java | 2 ++ .../foundation/web/ExceptionController.java | 14 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/pom.xml b/pom.xml index 4facd24..11ab507 100644 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,26 @@ ${org.egovframe.rte.version} + + javax.servlet javax.servlet-api diff --git a/src/main/java/cokr/xit/foundation/web/AccessInitializer.java b/src/main/java/cokr/xit/foundation/web/AccessInitializer.java index f16230a..887a451 100644 --- a/src/main/java/cokr/xit/foundation/web/AccessInitializer.java +++ b/src/main/java/cokr/xit/foundation/web/AccessInitializer.java @@ -9,6 +9,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.springframework.stereotype.Component; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.ModelAndView; @@ -26,6 +27,7 @@ import cokr.xit.foundation.component.ServiceRequest; * *

AccessInitializer가 동작하려면 인터셉터로 설정해야 한다.

*/ +@Component("accessInitializer") public class AccessInitializer extends RequestInterceptor { @Resource(name="applicationContainer") protected ApplicationContainer applicationContainer; diff --git a/src/main/java/cokr/xit/foundation/web/ExceptionController.java b/src/main/java/cokr/xit/foundation/web/ExceptionController.java index 0a9ab20..22a4497 100644 --- a/src/main/java/cokr/xit/foundation/web/ExceptionController.java +++ b/src/main/java/cokr/xit/foundation/web/ExceptionController.java @@ -55,6 +55,20 @@ public class ExceptionController extends AbstractController { .addObject("home", true); } + /**세션 만료 시 처리를 위한 정보를 갖는 ModelAndView를 반환한다. + * @param hreq 서블릿 요청 + * @return ModelAndView + */ + @RequestMapping("/error/invalidSession.do") + public ModelAndView invalidSession(HttpServletRequest hreq) { + return new ModelAndView(ajaxRequest() ? "jsonView" : "error/errorPage") + .addObject("path", getAction(hreq)) + .addObject("failed", true) + .addObject("status", "invalidSession") + .addObject("message", message("invalidSession")) + .addObject("home", true); + } + /**접근 거부 오류의 처리를 위한 정보를 갖는 ModelAndView를 반환한다. * @param hreq 서블릿 요청 * @return ModelAndView