【发布时间】:2011-08-28 23:47:43
【问题描述】:
我通过jquery.ajax call() 调用restAPI,一旦它完成我就不能使用我的其他ajax 调用,因此我被spring security 抛弃了。我注意到在完成 restAPI 调用后JsessionID 发生了变化(我使用 httpFox plugging for fire fox)。因此,在其余 API 调用之后,我将通过spring security 重定向到登录页面。我注意到我不再是授权用户了。我想如果我可以保留最初的'jsessionID'并通过我的浏览器使用它会很好。谁能给我一些指导,我该怎么做?提前致谢。
这是我的其余 api 代码
jQuery.ajax({
type: "POST",
//contentType: "application/json; charset=utf-8",
url: restUrl,
data: "{}",
dataType: "json",
success: function(msg) {
// load grids
try{
loadBaseGrid(); //this is a jqgrid
//will trigger once ajax call is success. but this
//will not complete successfully. becouse of the jsession ID change
}catch(e){
trace('Error in loadBaseGrid -'+e);
}
},
beforeSend : function(req) {
//req.setRequestHeader("Access-Control-Allow-Origin", "*");
//req.setRequestHeader('Authorization', token);
},
error:function (xhr, ajaxOptions, thrownError){
var res = xhr.responseText;
try{
//var err = JSON.parseWithDate(res);
trace(err);
}catch(e){
trace('Error ->'+e);
}
}
});
【问题讨论】:
标签: javascript jquery spring-mvc spring-security