【发布时间】:2017-11-15 10:39:49
【问题描述】:
当我在 Cloud Foundry 的 Fiori 启动板中将 Monitor 应用程序部署为 SAPUI5 应用程序时,我遇到了一个错误:
404 未找到: https://sapui5.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js
我在 FLP 中的配置:
/xs-app.json:
{
"source": "^/resources/sap/ui/iot/(.*)$",
"destination": "IOTAS_CONTROLS",
"target": "/sap/ui/iot/$1"
}
/mtad.yaml
modules:
requires:
- name: IOTAS_CONTROLS
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: IOTAS_CONTROLS
url: ~{url}
resources:
- name: IOTAS_CONTROLS
properties:
url: https://sapuiiot-sb.cfapps.sap.hana.ondemand.com
/Main.view.xml
<mvc:View
controllerName="monitor.controller.Main"
xmlns:iot="sap.ui.iot.controls"
xmlns:iotele="sap.ui.iot.elements"
xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
displayBlock="false">
<iot:IoTChart noOfHours="1" headerTitle="Temperature & Gas Volume" subheaderTitle="Unit: Degree & M3"/>
我尝试读取Controller.js中的“https://xxx-flp-sandbox.cfapps.sap.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js”,成功重定向到“https://sapuiiot-sb.cfapps.sap.hana.ondemand.com/sap/ui/iot/controls/IoTChart.js”,证明xs-app.json中的路由有效。
所以我的问题是,如果在 XML 视图中需要 sap.ui.iot.controls,它将始终使用域调用:https://sapui5.hana.ondemand.com,而 xs-app.js 中没有传递路径。
这个项目在webIDE中运行成功,因为在neo-app.json中定义了一个路由,重定向所有/resource/,请求总是在webIDE主机,但是在cloud foundry,它在sapui5.hana.ondemand主机
有什么建议吗?
试过了:
jQuery.sap.registerResourcePath("iotChart", "../../../../resources/sap/ui/iot/library")
jQuery.sap.require("iotChart")
//Still load host sapui5.hana.ondemand.com
var core=sap.ui.getCore();
core.loadLibrary("sap.ui.iot.controls");
【问题讨论】: