api 테스터 세션 연장 추가
This commit is contained in:
@@ -2,13 +2,16 @@ package com.eactive.httpmockserver.login.controller;
|
|||||||
|
|
||||||
import com.eactive.httpmockserver.user.service.UserService;
|
import com.eactive.httpmockserver.user.service.UserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -47,7 +50,7 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String message = (String) session.getAttribute(LOGIN_MESSAGE);
|
String message = (String) session.getAttribute(LOGIN_MESSAGE);
|
||||||
if (StringUtils.isNotEmpty(message)){
|
if (StringUtils.isNotEmpty(message)) {
|
||||||
model.addAttribute(LOGIN_MESSAGE, message);
|
model.addAttribute(LOGIN_MESSAGE, message);
|
||||||
}
|
}
|
||||||
session.setAttribute(LOGIN_MESSAGE, null);
|
session.setAttribute(LOGIN_MESSAGE, null);
|
||||||
@@ -61,14 +64,10 @@ public class LoginController {
|
|||||||
*
|
*
|
||||||
* @return result - String
|
* @return result - String
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/refreshSessionTimeout.do")
|
@GetMapping(value = "/refreshSessionTimeout.do", produces = "text/html;charset=utf-8")
|
||||||
public ModelAndView refreshSessionTimeout(@RequestParam Map<String, Object> commandMap) {
|
@ResponseBody
|
||||||
ModelAndView modelAndView = new ModelAndView();
|
public ResponseEntity<String> refreshSessionTimeout(@RequestParam Map<String, Object> commandMap) {
|
||||||
modelAndView.setViewName("jsonView");
|
return ResponseEntity.ok("success");
|
||||||
|
|
||||||
modelAndView.addObject("result", "ok");
|
|
||||||
|
|
||||||
return modelAndView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/actionLogout.do")
|
@GetMapping("/actionLogout.do")
|
||||||
|
|||||||
@@ -275,7 +275,16 @@
|
|||||||
<th:block layout:fragment="contentScript">
|
<th:block layout:fragment="contentScript">
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
const timer = setInterval(function () {
|
||||||
|
$.ajax({
|
||||||
|
url: '/refreshSessionTimeout.do',
|
||||||
|
type: 'GET',
|
||||||
|
contentType: 'application/json',
|
||||||
|
complete: function () {
|
||||||
|
controller.hideLoadingOverlay();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 60000);
|
||||||
let apiRequests = [];
|
let apiRequests = [];
|
||||||
let collections = [];
|
let collections = [];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user