【发布时间】:2016-04-03 20:04:58
【问题描述】:
我有 2 个应用程序,一个在 struts 中,另一个在 spring 中。从 struts 应用程序我有一个链接,它将通过返回 model 的 ajax 调用调用 spring 应用程序控制器。
在 struts 应用程序中,我有 20 分钟的会话超时,并且在为在 struts 应用程序中呈现的 spring 应用程序执行任何事务时,struts 应用程序中的会话超时保持不变,并且在 20 分钟后它会注销。
struts 应用 jsp 页面。
<body>
<div id="content"></div>
</body>
<script type="text/javascript">
$(document).ready(function() {
var sessionId = '<%= sessionId %>'
$.ajax({
type: "GET",
url: '/springapp/index.app?id='+sessionId,
data: "" ,
success: function(response){
$('#content').html(response);
},
error: function(e){
alert('Error: ' + e);
console.log(e)
}
});
});
</script>
Spring 应用程序控制器。
@RequestMapping(value = "/*.app", method = {RequestMethod.GET, RequestMethod.POST})
public String jspController(ServletRequest req, ServletResponse res) throws exception {
LOGGER.debug("inside jspController() start");
HttpServletRequest request = (HttpServletRequest) req;
String model = request.getRequestURI();
if (model.endsWith("index.app")) {
String sessionKey = request.getParameter("employeeId");
SpringStrutsHandshake springStrutsHandshake = securityDelegate.getUserId(sessionKey);
User user = userDelegate.getUserByEmployeeId(springStrutsHandshake.getUserId());
user.setSessionKey(sessionKey);
request.setAttribute("USER", user);
model = "candidateList";
} else {
model = model.substring(model.lastIndexOf("/") + 1, model.lastIndexOf("."));
}
return model;
}
当呈现的 spring 应用程序页面中有任何事务时,您能帮我解决超时问题吗?
【问题讨论】:
标签: javascript spring session timeout