如何以独立于会话的方式访问IBM

如何以独立于会话的方式访问IBM

本文介绍了如何以独立于会话的方式访问IBM MobileFirst 7.1默认属性存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将IBM MobileFirst 6.3项目迁移到7.1版,并启用7.1会话独立模式.我已将属性存储指定为Worklight默认运行时数据库.

I am working on migrating a IBM MobileFirst 6.3 project to version 7.1 and enabling the 7.1 session independent mode. I have specified the attribute store as the worklight default runtime database.

在以前的版本中,我已在HTTP JavaScript适配器中使用HTTPSession对象来动态存储一些与当前用户会话相关的最小数据,如下面的示例代码所示.

In the previous version I have used HTTPSession object in HTTP JavaScript adapters to dynamically store some minimal data related to the current user session as shown in the sample code below.

    var request = WL.Server.getClientRequest();
    var session = request.getSession();
    session.setAttribute("ID", "123");
    session.setAttribute("UserName", "xxx");

由于我无法再使用会话对象,是否有任何WL.Server API可用于显式存储/检索/从默认属性存储(WL运行时数据库)中删除数据?找不到关于此的任何示例.请指教.谢谢.

As I cannot use session object anymore, are there any WL.Server APIs available for explicitly store/retrieve/remove data from the default attribute store (WL run-time database)? Couldn't find any examples on this. Please advise. Thanks.

推荐答案

知识中心在此处记录了7.1会话独立模式的此方案和解决方案

Knowledge center documents this scenario and solution for 7.1 Session Independent mode here

https://www.ibm.com/support/knowledgecenter/zh-CN/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/devref/c_java_server_side_api.html#java_server_side_api__java_rest

在Java RESTful适配器中的请求之间保存应用状态

In versions earlier than V7.1.0, developers were able to store the applicative state in the HTTP session, by using the session object, namely request.getSession() (see WL.Server).

If you are working in session-independent mode that became available starting with IBM MobileFirst Platform Foundation V7.1.0, the applicative state of the adapter must be persisted outside the session, for example, by using a database such as Cloudant®

样品也附在上面的链接中.

Sample also is attached in the link above.

这篇关于如何以独立于会话的方式访问IBM MobileFirst 7.1默认属性存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:11