Spring 春季保安及;ExtJS-会话超时时重定向到登录页面
我正在使用ExtJS和springmvc/Security。我希望在会话过期时将用户重定向到登录页面,我在Spring安全应用程序上下文中给出了这一点-Spring 春季保安及;ExtJS-会话超时时重定向到登录页面,spring,spring-mvc,extjs,spring-security,Spring,Spring Mvc,Extjs,Spring Security,我正在使用ExtJS和springmvc/Security。我希望在会话过期时将用户重定向到登录页面,我在Spring安全应用程序上下文中给出了这一点- <session-management invalid-session-url="/login.jsp"></session-management> 您可以通过以下方式覆盖所有ajax请求,以测试超时会话响应并相应地处理它: var origHandleResponse = Ext.data.Connection.pr
<session-management invalid-session-url="/login.jsp"></session-management>
您可以通过以下方式覆盖所有ajax请求,以测试超时会话响应并相应地处理它:
var origHandleResponse = Ext.data.Connection.prototype.handleResponse;
Ext.override(Ext.data.Connection, {
handleResponse : function(response){
var text = Ext.decode(response.responseText);
if (<test for response that means the session timed out>)
{
var login = new Ext.Window({
plain: true,
closeAction: 'hide',
modal: true,
title: "Login timed out, please log in.",
width: 400,
autoHeight: true,
items: [
{
xtype: 'form',
id: 'login-form',
items: [
{
xtype: 'textfield',
fieldLabel: 'Username',
name: 'username'
},
{
xtype: 'textfield',
inputType: 'password',
fieldLabel: 'Password',
name: 'password'
}]
}],
buttons: [
{
text: 'Submit',
handler: function() {
Ext.getCmp('login-form').getForm().submit({url: '<login url>'});
login.hide();
}
}]
});
login.show();
}
//else (optional?)
origHandleResponse.apply(this, arguments);
}
var origHandleResponse=Ext.data.Connection.prototype.handleResponse;
Ext.override(Ext.data.Connection{
HandlerResponse:功能(响应){
var text=Ext.decode(response.responseText);
如果()
{
var login=新的外部窗口({
朴素:没错,
closeAction:'隐藏',
莫代尔:是的,
标题:“登录超时,请登录。”,
宽度:400,
自动高度:正确,
项目:[
{
xtype:'表单',
id:'登录表单',
项目:[
{
xtype:'textfield',
fieldLabel:'用户名',
名称:“用户名”
},
{
xtype:'textfield',
输入类型:“密码”,
fieldLabel:“密码”,
名称:“密码”
}]
}],
按钮:[
{
文本:“提交”,
处理程序:函数(){
Ext.getCmp('login-form').getForm().submit({url:'});
login.hide();
}
}]
});
login.show();
}
//其他(可选?)
应用(这个,参数);
}
})) 可能与
var origHandleResponse = Ext.data.Connection.prototype.handleResponse;
Ext.override(Ext.data.Connection, {
handleResponse : function(response){
var text = Ext.decode(response.responseText);
if (<test for response that means the session timed out>)
{
var login = new Ext.Window({
plain: true,
closeAction: 'hide',
modal: true,
title: "Login timed out, please log in.",
width: 400,
autoHeight: true,
items: [
{
xtype: 'form',
id: 'login-form',
items: [
{
xtype: 'textfield',
fieldLabel: 'Username',
name: 'username'
},
{
xtype: 'textfield',
inputType: 'password',
fieldLabel: 'Password',
name: 'password'
}]
}],
buttons: [
{
text: 'Submit',
handler: function() {
Ext.getCmp('login-form').getForm().submit({url: '<login url>'});
login.hide();
}
}]
});
login.show();
}
//else (optional?)
origHandleResponse.apply(this, arguments);
}