SAP Fiori image的显示原理
Recently I am working on an issue regarding my responsible application and I found out that previously I have wrong understanding on the image handling in CRM Fiori. I share the correct one in this knowledge so that you would not make similar mistake that I made before.
Background
In CRM Fiori application “My Opportunity”, if the account for current Opportunity has maintained image in CRM backend, it will then be displayed in Fiori UI.
How to maintain account Logo in CRM so that it could be displayed in Fiori UI
We have to launch CRM WebUI, upload a new attachment for given account:
This attachment should meet the following criteria, to make sure it could be used as logo for the current account:
(1) it must be an image file ( type JPEG Graphic or other image format ) (2) in property maintenance window, it must be set as default document among all attachments and document type must be BDS_IMAGE.
In the runtime, when you open Fiori UI, it takes two steps to get the image rendered in UI finally. These two steps could just be observed in the Chrome network tab.
Step1 – Fiori UI asks for the image URL from backend
Previously, I consider Fiori UI asked the binary content of image from backend, this is COMPLETELY WRONG! The complete url for the first step: https://:/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AccountCollection(‘4031140’)?$expand=Logo From url we know there is an expand operation on node Logo. Check response in Chrome, there is no image binary source contained in response.
the url contained in Logo node is used as the requested url for the second step, as could be observed in Chrome:
: The complete url returned by first step: https://:/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AttachmentCollection(documentID=‘FA163EEF573D1EE585804C8B6241ABA3′,documentClass=’BDS_POC1′,businessPartnerID=’4031140’)/$value Although it contains an “Attachment” in url, it HAS NOTHING TO DO WITH the tab in Opportunity detail page! It just indicates that the technical storage of account logo is done via CRM Attachment model.
Step2 – bind the url to image field in application
Check the xml binding path for image field in Opportunity detail view: it is bound to ImgSrc in json model.
In application code, it just fills that json model field with url returned by step 1:
And this operation will lead to a delayed re-render later to set the native html property “src” for image field, which is done by framework:
Callstack:
Conclusion
The http request sent in second step is not issued by My Opportunity application, but by browser itself, once an image element is filled with actual url on its “src” property. To simply prove this conclusion: Create a simple html file as below, just paste the url for second step into src property:
<html>
<img src="https://<hostname>:<port>/sap/opu/odata/sap/ZJERRY_DEMO_SRV/AttachmentCollection(documentID='FA163EEF573D1EE585804C8B6241ABA3',documentClass='BDS_POC1',businessPartnerID='4031140')/$value"></img>
<html>
Open it in Chrome, and you can observe exactly the same network behavior as when you open the application with an image in Fiori UI:
- Android Studio你不知道的调试技巧
- Android 数据绑定框架DataBinding,堪称解决界面逻辑的黑科技
- 汽车黑客:没有Security就没有Safety
- Android 自定义View高级特效,神奇的贝塞尔曲线
- Android二维码扫描开发(一):实现思路与原理
- 说一道简单的BCTF题 – 分分钟而已
- 安全扫描工具Nmap引擎理解文档
- AppFuse项目笔记(1)
- 电子商务系统ShopNC多个漏洞(可暴力 getshell)
- 利用Google爬虫DDoS任意网站
- 极客都应该知道的Linux技巧
- 酷似感冒,变色龙病毒可在WiFi接入点间感染
- Linux下的常见错误配置
- 使用C#实现蜘蛛程序
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 客服MM被投诉说下单耗时很长,老板下令必须控制在1秒以内
- 介绍两个刷 SQL 题的网站
- Spring MVC 你必须关注点
- 微信小程序开发实战(12):滑杆组件(slider)和form组件
- pandas按照指定的列排序、paste命令指定分隔符、ggplot2添加拟合曲线
- 连连看
- 交叉验证
- lipo命令
- protobuf 为经络,gRPC为骨架
- JVM系列之:String,数组和集合类的内存占用大小
- 如何用 Python 写个登陆窗口?
- 3500 字算法刷题精华总结
- web 云开发获取匿名登录返回的uid
- MySQL 最佳实践:慢查询分析三步曲
- 【NLP】利用jieba对网易云音乐的评论进行词云分析