IsoBean模組管理
# FastWeb IsoBean模組管理
# 1. 簡介
IsoBean模組的功能界面與設計模式與RestAPI設計是相同的,與RestAPI設計的不同是,IsoBean模組可以繫結Bean模組,從而更方便地利用RestAPI的特性來與Bean模組配合達到設計的效果。且IsoBean提供了配套的監控模組用於對發佈的IsoBean模組進行管理。而RestAPI僅作為單純的API來使用,無配套的監控模組。
# 2. 設定IsoBean模組
點選左側功能表欄中的 云服務工具-IsoBean模組管理
,打開IsoBean模組管理的界面。模組列表中的項會根據分組進行排序,可從表格頂部的篩選框中輸入資訊來快速查詢相關模組。
# 2.1. 操作說明
新增IsoBean
點選 [新增]
按鈕,打開新增IsoBean模組對話方塊,輸入IsoBean編號、標題,選擇IsoBean的類別,如果目前的IsoBean需引用Bean模組,則需要額外選擇要繫結的Bean模組,選擇開發使用者,講基本資訊輸入完成後點選 [儲存]
按鈕即可。
修改IsoBean
如果需要修改IsoBean模組列表中已有模組的基本資訊,選擇要修改的IsoBean模組,點選[修改]
按鈕打開修改IsoBean
的對話方塊,在其中修改模組的資訊,修改完成後點選[儲存]
按鈕儲存。
刪除IsoBean
如需要刪除某個IsoBean模組,選擇在模組列表中要刪除的IsoBean模組,點選[刪除]
按鈕,此時會彈出刪除IsoBean模組的提示資訊,點選[是]
可刪除選擇的模組,如不需要刪除模組,點選[否]
。
API設計
選擇要設計API的IsoBean,點選 [API設計]
按鈕,進入至IsoBean的API設計界面。填寫程式碼後進行測試。關於更多的用法可參考 RestAPI設定程式用法 。
Bean設計
Bean設計的內容為繫結的Bean模組的設計,如果
# 2.2. IsoBean引用
IsoBean模組需通過Url參數來引用。引用的Url格式示例如下。
http://localhost:8888/?isobean=isobean-001¶mname=paramvalue&...
可使用的參數見下列表。
參數名稱 | 型別 | 描述 | 是否必選 |
---|---|---|---|
isobean | String | 設定IsoBean模組的編號,也可使用IsoBean模組記錄的唯一地址 | 是 |
token | string | 身份認證的令牌,如果IsoBean未勾選免驗證令牌的選項,此項為必填項 | 否 |
userkey | String | IsoBean運行的使用者的ID,如果運行的是圖形界面的Bean模組,此項為必填項,在使用IsoBean發佈后才可使用 | 否 |
language | String | IsoBean顯示的語言型別的名稱,在多語言環境中適用,不設定此參數會使用簡體中文作為預設顯示語言 | 否 |
其中引用的示例的 paramname=paramvalue
是自行定義的參數,這些自定義的參數可在Bean模組的指令碼中獲取。通過這種方式,可動態獲取參數,在指令碼中處理后實時展示。獲取參數值的指令碼示例如下。
//JScript
// s獲取到的Url參數paramname的取值為 paramvalue
var s = URLParams.Values["paramname"];
2
3
//PasScript
s := URLParams.Values['paramname'];
2
// Make sure to add code blocks to your code group
IsoBean中支援特殊變數 Var_Bean
、Var_UserKey
與 Var_Language
。變數的說明如下。
名稱 | 說明 |
---|---|
Var_Bean | Bean模組的GUID或者Bean模組的編號,此參數值從IsoBean繫結的Bean模組資訊(GUID或Bean編號)中獲取 |
Var_UserKey | IsoBean發佈使用者的GUID,此參數值由IsoBean呼叫的URL參數 userkey 中獲取 |
Var_Language | IsoBean顯示的語言,此參數值由IsoBean呼叫的URL參數 language 中獲取,如參數未設定,預設使用簡體中文 zh-CN |
使用的WEB示例程式程式碼如下。
//JScript
function RestAPI()
{
var url;
url = "/?bean="+Var_Bean + "&userkey=" + Var_UserKey + "&language=" + Var_Language;
Result = " <html>"
+ " <body style=\"margin: 0px;height: 100%;width: 100%;\">"
+ " <iframe width=\"100%\" height=\"100%\" frameborder=\"no\" border=\"0\" marginwidth=\"0px\" marginheight=\"0px\" scrolling=\"no\" allowtransparency=\"yes\" src=\"" + url + "\""
+ " width=\"100%\""
+ " height=\"100%\""
+ " >"
+ " </iframe>"
+ " </body>"
+ " </html>";
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//PasScript
function RestAPI:String;
var
url: String;
begin
url := '/?bean='+Var_Bean + '&userkey=' + Var_UserKey + '&language=' + Var_Language;
Result := ' <html>'
+ ' <body style="margin: 0px;height: 100%;width: 100%;">'
+ ' <iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0px" marginheight="0px" scrolling="no" allowtransparency=\"yes\" src="' + url + '"'
+ ' width="100%"'
+ ' height="100%"'
+ ' >'
+ ' </iframe>'
+ ' </body>'
+ ' </html>';
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Make sure to add code blocks to your code group
使用的APP示例程式程式碼如下:
//JScript
function RestAPI()
{
var url;
url = "/?bean="+Var_Bean + "&userkey=" + Var_UserKey + "&language=" + Var_Language;
Result = " <html>"
+ "<meta name=\"viewport\" content=\"width=device-width\" />"
+ " <body style=\"margin: 0px;height: 100%;width: 100%;\">"
+ " <iframe width=\"100%\" height=\"100%\" frameborder=\"no\" border=\"0\" marginwidth=\"0px\" marginheight=\"0px\" scrolling=\"no\" allowtransparency=\"yes\" src=\"" + url + "\""
+ " width=\"100%\""
+ " height=\"100%\""
+ " >"
+ " </iframe>"
+ " </body>"
+ " </html>";
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//PasScript
function RestAPI:String;
var
url: String;
begin
url := '/?bean='+Var_Bean + '&userkey=' + Var_UserKey + '&language=' + Var_Language;
Result := ' <html>'
+ '<meta name="viewport" content="width=device-width" />'
+ ' <body style="margin: 0px;height: 100%;width: 100%;">'
+ ' <iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0px" marginheight="0px" scrolling="no" allowtransparency=\"yes\" src="' + url + '"'
+ ' width="100%"'
+ ' height="100%"'
+ ' >'
+ ' </iframe>'
+ ' </body>'
+ ' </html>';
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Make sure to add code blocks to your code group
# 3. IsoBean發佈
IsoBean發佈的功能可以使使用者用更快捷的方式打包發佈IsoBean專案,亦可隨時對發佈的IsoBean專案進行管理,或者刪除已發佈的IsoBean專案。
在 IsoBean模組管理的主界面,點選 [IsoBean發佈]
,打開IsoBean發佈界面。
新增IsoBean發佈
左側的使用者列表中選擇要新增IsoBean發佈的使用者,然後點選 [IsoBean選擇...]
,打開IsoBean列表,雙擊要匯入的IsoBean發佈專案,就可以將專案匯入至發佈的列表中,下方可檢視發佈的專案的預設參數資訊。點選 [儲存]
按鈕儲存發佈設定,點選 [發佈]
按鈕,將選擇的IsoBean專案發佈部署。點選 [預覽]
按鈕,可檢視發佈的鏈接,此鏈接可用於引用。
IsoBean發佈的示例鏈接如下。
http://localhost:8888/?isobean={isobean_code}&userkey={user_guid}&language={Language}&tag={tag}
其中 {isobean_code}
是 IsoBean的編號,{user_guid}
是使用者的唯一ID,{Language}
為語言型別。language參數可不使用。{tag}
為識別標記,如果不使用tag則設定預設tag為 0。
# 4. IsoBean專用API
# 4.1. getframemaps
此API可獲取目前運行的會話資訊。
請求示例如下,以下根據Bean模組編號查詢運行的會話列表資訊。
http://{url}:{port}/restapi=getframemaps
{url}:{port}
表示FastWeb伺服器的地址與埠號。
返回的示例如下:
[{"guid":"4Oe1nrPoNl10A5584C2#@@#O74","moduleguid":"78C1CA28-CB4F-4D78-AF2B-4F9C321ECDF7","modulecode":"picture_reco","modulename":"影象識別","moduletype":"BEAN","jsname":"O74","sid":"4Oe1nrPoNl10A5584C2","username":"admin","token":"2160645A7C365D3718F1488571D1D950","createtime":"2022-05-02 10:33:40.000","tag":0,"userkey":"84C2BF69-F6BB-43F4-9869-E705C813F488","isobeanno":null}]
可通過指定Bean模組編號篩選會話資訊:
http://{url}:{port}/restapi=getframemaps&modulecode={beanname}
modulecode
表示模組編號的參數名稱。{beanname}
為要獲取資訊的模組參數編號。
也可查詢使用者的所有會話資訊:
http://{url}:{port}/restapi=getframemaps&userkey={userguid}
其中的userkey
為使用者的唯一ID資訊。
# 4.2. getconnections
此API用於獲取連線的資訊。
請求的示例如下:
http://{url}:{port}/restapi=getconnections
返回的示例如下。
[{"sid":"4DczcVjhjh10A557546","guid":"162D55EE688D466C8A8E0A175EE50B2D","nodeid":-1,"createtime":"2022-05-02 09:36:51.000"},{"sid":"y8Ryn3Oxef10A5585A3","guid":"0675B5B45378402C889DA67E06FF06A2","nodeid":-1,"createtime":"2022-05-02 10:36:54.000"}]
# 4.3. getisobeanparams
此API可用於獲取IsoBean中使用者可使用的參數的資訊。
請求的示例如下:
http://{url}:{port}/restapi=getisobeanparams&isobean={isobeanname}&userkey={userguid}
返回的示例如下:
%5B%7B%22fdcheck%22%3Atrue%2C%22fdparamname%22%3A%22imgpath%22%2C%22fdparamvalue%22%3A%22library%5C%2Fjs%5C%2Fml5-library%5C%2Fassets%5C%2Fcat.jpg%22%2C%22fdparamdescription%22%3A%22%E8%AF%86%E5%88%AB%E5%9B%BE%E7%89%87%E7%9A%84%E8%B7%AF%E5%BE%84%22%7D%5D
返回的內容經過URL編碼,使用URL解碼可恢復爲目標格式。
# 4.4. getisobeanlist
此API可獲取使用者所有可用的IsoBean模組列表。
請求的示例如下:
http://{url}:{port}/restapi=getisobeanlist&userkey={userguid}
返回的示例如下:
%5B%7B%22isobeanno%22%3A%22IB_flying%22%2C%22isobeanname%22%3A%22%E9%87%8D%E5%90%AFFlying%22%2C%22isobeantype%22%3A%22batch%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-20+14%3A36%3A59.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_chatroom_m%22%2C%22isobeanname%22%3A%22%E7%BD%91%E7%BB%9C%E8%81%8A%E5%A4%A9%E5%AE%A4(App)%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-26+16%3A24%3A53.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_wb-vis-0011_radialgauge%22%2C%22isobeanname%22%3A%22%E5%9C%86%E5%BD%A2%E4%BB%AA%E8%A1%A8%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-29+16%3A31%3A27.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_demolist%22%2C%22isobeanname%22%3A%22%E8%8C%83%E4%BE%8B%E6%B1%87%E6%80%BB%E7%9A%84%E8%AF%B4%E6%98%8E%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-25+16%3A30%3A30.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_reportapi%22%2C%22isobeanname%22%3A%22URL%E8%8E%B7%E5%8F%96%E6%8A%A5%E8%A1%A8%22%2C%22isobeantype%22%3A%22report%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-23+09%3A53%3A02.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_ganttchart%22%2C%22isobeanname%22%3A%22%E7%94%98%E7%89%B9%E5%9B%BE%E5%B1%95%E7%A4%BA%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-25+16%3A54%3A30.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_hydren_view%22%2C%22isobeanname%22%3A%22%E7%8E%AF%E7%BB%95%E9%A3%8E%E6%99%AF%E5%B1%95%E7%A4%BA%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-25+17%3A25%3A44.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_report_mancontact%22%2C%22isobeanname%22%3A%22%E7%94%9F%E4%BA%A7%E8%AE%A2%E5%8D%95%E6%8A%A5%E8%A1%A8%22%2C%22isobeantype%22%3A%22report%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-25+22%3A43%3A38.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_picture_reco%22%2C%22isobeanname%22%3A%22%E5%9B%BE%E7%89%87%E8%AF%86%E5%88%AB%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-25+22%3A01%3A46.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_online_document%22%2C%22isobeanname%22%3A%22%E7%BD%91%E7%BB%9C%E6%96%87%E6%A1%A3%E6%B5%8F%E8%A7%88%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-30+16%3A04%3A39.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_process_dashboarddemo1%22%2C%22isobeanname%22%3A%22%E6%9B%B4%E6%96%B0%E5%A4%A7%E5%B1%8F%E5%B1%95%E7%A4%BA1%22%2C%22isobeantype%22%3A%22process%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-04-19+16%3A13%3A38.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%2C%7B%22isobeanno%22%3A%22IB_purorder_edit%22%2C%22isobeanname%22%3A%22%E9%87%87%E8%B4%AD%E8%AE%A2%E5%8D%95%E7%BC%96%E8%BE%91%22%2C%22isobeantype%22%3A%22vision%22%2C%22createuser%22%3A%22admin%22%2C%22createtime%22%3A%222022-05-01+00%3A37%3A34.000%22%2C%22editoruser%22%3A%22admin%22%2C%22editortime%22%3A%222022-05-01+00%3A37%3A34.000%22%7D%5D
返回的內容經過URL編碼,使用URL解碼可恢復爲目標格式。