日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP BSP应用有状态和无状态行为差异比较

發(fā)布時(shí)間:2023/12/19 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP BSP应用有状态和无状态行为差异比较 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

In previous blog Fiori and CRM WebClient UI – Stateless and Stateful, but how? I have researched how stateful and stateless BSP application are handled in ABAP server side. In this blog I will explain how stateful and stateless BSP application behave differently.

The test BSP application I am using

It consists of three files.

first.json

<%@page language="abap" %> <% WAIT UP TO 3 SECONDS. %> { "message":"First page wait 3 seconds" }

Here I use WAIT keyword to simulate that it will take 3 seconds for the first request to finish.

index.html

In this html file, I fire two requests to fetch “first.json” and “second.json” one by one. The first request is sent before second request.

<%@page language="abap" %> <%@extension name="htmlb" prefix="htmlb" %> <!DOCTYPE html> <html> <head> <title>Jerry Test Stateful</title> </head> <body> <button onclick="fire()">Fire two request</button> <script> function wrapperOnFetch(url){fetch(url,{ credentials:"include" }).then(function(response){return response.json();}).then(function(json){console.log(url + ":" + json.message);}); } function fire(){wrapperOnFetch("first.json");wrapperOnFetch("second.json"); } </script> </body> </html>

second.json

<%@page language="abap"%> { "message":"Second page no wait to response" }

The application is firstly set as Stateful:

Stateful test

(1) Launch index.html, and in Chrome development tool you can see there are three “set-cookie” in Response Header fields.

One of them, the sap-contextid is set in method ON_REQUEST_LEAVE of CL_BSP_RUNTIME explained in previous blog.

And you can observe the cookie in tab “Application”:

The cookie could also be reviewed in Chrome via Settings
->Advanced Settings->Privacy->Content Settings->All cookies and site data…

(2) click button “Fire two request”, and in console we can observe that these two requests are handled sequentially in server: the response of first request still comes first before the response of second request.

This could also be confirmed in the Network tab. The first request takes totally 3 seconds to finish. During the wait of this 3 seconds, the process of second request is pending till the first request finishes. As a result finally both request takes around 3 seconds to get handled.

We can also observe that the cookie set by index.html load is now automatically appended as the request header for “first.json” and “second.json” request:


Stateless test

Now set application as stateless and open index.html again:

Compare the cookie with stateful test, this time the cookie
sap-contextid is not there. This observation is consistent with what I found in blog Fiori and CRM WebClient UI – Stateless and Stateful, but how?, as it will only be set in stateful application.

Click fire button, and we can find in stateless application, these two requests are handled by server in parallel: the response of second request is now coming first before the response of first request.

In Network tab, once fire button is clicked, the second request gets processed almost immediately, and the first request still has status “Pending”.

After 3 seconds the first request is done, total duration is around 3 seconds:

In Stateless application, it is clearly observed that cookie field
sap-contextid is not involved in the request & response handling.


要獲取更多Jerry的原創(chuàng)文章,請關(guān)注公眾號"汪子熙":

總結(jié)

以上是生活随笔為你收集整理的SAP BSP应用有状态和无状态行为差异比较的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。