【发布时间】:2016-06-02 13:31:14
【问题描述】:
我正在使用 REST API 开发 ATG 门户,所有 ATG API 都使用 PostMan 进行了测试。 当我开始在 JS 中工作时出现错误。以下是测试代码:
http({
method : "GET",
url : "http://IP:PORT/rest/model/atg/rest/SessionConfirmationActor/getSessionConfirmationNumber"
}).then(function mySucces(response){
// localStorage.setItem("getSessionConfirmationNumer", response.data.sessionConfirmationNumber);
// localStorage.getItem("getSessionConfirmationNumer");
http({
method : "GET",
url : "http://IP:PORT/rest/model/atg/userprofiling/ProfileActor/login?_dynSessConf="+response.data.sessionConfirmationNumber+"&login=atgcust1&password=atgcust1",
// url : "http://IP:PORT/rest/model/atg/userprofiling/ProfileActor/login",
// data:formData
}).then(function mySucces(response){
console.log("done");
},function errorCallback(response) {
console.log(response);
});
});
从控制台输出:
angular.js:10722 GET http://IP:PORT/rest/model/atg/userprofiling/ProfileActor/login?_dynSessConf=9030570900570011195&login=atgcust1&password=atgcust1 409 (冲突)(匿名函数) @ angular.js:10722p @ angular.js:10515g @ angular.js:10222(匿名函数) @ angular.js:14745n.$ eval @ angular.js:15989n.$digest @ angular.js:15800n.$apply @ angular.js:16097(匿名函数) @ angular.js:23554n.event.dispatch @ jQuery-2.1.4.min.js: 3r.handle@jQuery-2.1.4.min.js:3 函数.js:75
Object {data: "Your session expired due to inactivity.", status: 409, config: Object, statusText: "Conflict"}
会话确认号只能访问一次,之后会出现500内部服务器错误(这个逻辑我写的不在这里),
当我从浏览器手动获取会话确认号并在代码中手动将其作为 _dynSessConf 值时,登录正常
请帮忙。
【问题讨论】:
-
请帮助,任何来自 ATG 和 Angular 背景的专家。
标签: angular-http atg atg-dynamo atg-droplet atg-dust