我做了简单的申请。添加了android和desktopbrowser环境。 Android应用程序工作正常。
预览desktopbrowser环境时无限次获取“错误访问拒绝重新加载”对话框。
在" worklight.properties"中进行了两次更改。文件。
mfp.session.independent=false
mfp.attrStore.type=HttpSession
尝试重新启动服务器和eclipse。
下面重现的代码:
function wlCommonInit(){
WL.Client.connect({
onSuccess: onConnectSuccess,
onFailure: onConnectFailure
});
}
function onConnectSuccess(){
alert("Connected to Server");
WL.Client.checkForDirectUpdate();
}
function onConnectFailure(){
alert("Connection Failure");
}
$("p").click(function(){
alert("Paragraph Clicked");
getData();
});
function loadFeedsSuccess(result){
invocationResult = result.invocationResult;
alert(JSON.stringify(invocationResult.firstName));
alert(JSON.stringify(invocationResult.lastName));
}
function loadFeedsFailure(error){
console.log("Feed retrieve failure");
alert(JSON.stringify(error));
alert("Feed retrieve failure");
}
function getData() {
var invocationData = {
adapter : 'Test',
procedure : 'getAdapter',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : loadFeedsSuccess,
onFailure : loadFeedsFailure,
});
}
答案 0 :(得分:1)
我无法重现这一点。
mfp.attrStore.type=HttpSession
和mfp.session.independent=false
WL.Client.connect()
的代码 - > wlCommonInit()
我收到了一个显示“成功”的对话框(onSuccess
成功回调)。