MobileFirst使用适配器直接更新自定义 [英] MobileFirst Direct update customization using adapter

查看:227
本文介绍了MobileFirst使用适配器直接更新自定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过从适配器获取所有消息来自定义直接更新。
如果触发直接更新,我没有得到适配器成功回调。
我想显示一个对话框,为用户提供取消直接更新的选项。
以下是我正在尝试的代码:

I am trying to customize direct update by getting all the messages from an adapter. I am not getting adapter success callback if direct update is triggered. I want to show a dialog giving option to the user to cancel direct update. Below is the code I am trying with:

 wl_directUpdateChallengeHandler.handleDirectUpdate = function (directUpdateData,directUpdateContext){
    console.log("Test for directUpdate");
    var invocationData = {
            adapter : 'DirectUpdateCustomizationAdapter',
            procedure : 'getConfig',
            parameters : ["android","1.9.0"]
        };
    var result = WL.Client.invokeProcedure(invocationData,{timeout: 30000,
        onSuccess :  function(success){
            console.log("Adapter call success" + JSON.stringify(success));
        },
        onFailure : function(failure){alert(3);console.log("Adapter call fail" + JSON.stringify(failure));},
    });

};

我使用以下安全测试:

<customSecurityTest name="customTests">
            <test realm="wl_antiXSRFRealm" step="1"/>
            <test realm="wl_authenticityRealm" step="1"/>
            <test realm="wl_remoteDisableRealm" step="1"/>
            <test realm="wl_directUpdateRealm" mode="perSession" step="1"/>
            <test realm="wl_anonymousUserRealm" isInternalUserID="true" step="1"/>
            <test realm="wl_deviceNoProvisioningRealm" isInternalDeviceID="true" step="2"/>
        </customSecurityTest>

如果未触发直接更新且适配器调用在挑战处理程序之外,则适配器调用成功。

If direct update is not triggered and adapter call is outside challenge handler then adapter call is successful.

请指导。

推荐答案

要使这种流程正常工作,方法DirectUpdateCustomizationAdapter必须从任何安全性中删除#getConfig并使用不受保护的访问。
含义:在DirectUpdateCustomizationAdapter适配器的xml文件
中getConfig方法应该有一个额外的属性:

for such flow to work , the method DirectUpdateCustomizationAdapter#getConfig must be stripped from any security and use unprotected access. meaning: in the DirectUpdateCustomizationAdapter adapter's xml file the method getConfig should have an additional property :

<procedure name="getConfig"  securityTest="wl_unprotected" />

因为getConfig返回非机密数据我相信可以取消保护它。
适配器代码中的此类更改需要将适配器文件重新部署到Worklight服务器。

since getConfig returns non-confidential data I believe its ok to un-secure it. such change in the adapter code requires to re-deploy the adapter file to the Worklight server.

然而,不建议在直接更新处理程序期间从远程服务器检索数据。正如Idan在这里所说,自定义标题,正文和其他文本元素的最佳方法实际上是在设备上的某些属性文件中包含这些字符串(网络跳跃需要花费时间)。
使用新文本更新此类属性文件可以通过直接更新机制本身完成(就像更新任何其他Web资源一样)。

Nevertheless, retrieving data from remote server during direct update handler is not recommended. As Idan stated here, the best approach to customize the title,body and other text elements is actually having those strings in some property file on the device (network hop does cost time). Updating such property file with new text can be done via the direct update mechanism itself (just like updating any other web resource).

这篇关于MobileFirst使用适配器直接更新自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆