應(yīng)用結(jié)構(gòu)圖
深入分析結(jié)構(gòu)圖
mina的基本應(yīng)用可以分為3層:
1、I/O Serivce:實際執(zhí)行I/O層
2、I/OFilter chain:數(shù)據(jù)過濾和轉(zhuǎn)換層,主要是把字節(jié)轉(zhuǎn)換為需要的數(shù)據(jù)格式或者反過來處理
3、I/OHandler:業(yè)務(wù)處理層
創(chuàng)建Mina應(yīng)用分為3部分:
1、創(chuàng)建I/O 2、創(chuàng)建過濾鏈
3、創(chuàng)建I/O業(yè)務(wù)處理
Dojo通過很少的代碼完成了以上的功能。(以后可能我詳細(xì)說說dojo的package system ,只需要三個js文件)。當(dāng)你寫腳本時,只需要包含很少的js文件(大小)。也可以選擇的(包含)下載dojo提供的龐大的功能。Dojo provides MultiplePointsOfEntry, InterpreterIndependence, ForwardLookingAPIs, and focuses on ReducingBarriersToAdoption.
dojo試圖建立一種新的標(biāo)簽語言DojoML。目標(biāo)是,在DojoML和javascript腳本語言不變的情況下,用不同的render方式展示數(shù)據(jù), Renderings may be made available in several rendering contexts (such as SVG, or perhaps even the desktop or Flash)。(比較美好啊)更進(jìn)一步,the DojoML 剖析器可以接受html和svg為輸入,容易的建立DegradeableResponsiveApplications。
第一部分 安裝
第一個小節(jié) 怎么安裝Dojo Toolkit
Dojo在磁盤上只是一堆文件,它不需要特殊的設(shè)置,它可以通過以下三種途徑獲得:
1、可以從google的內(nèi)容分布網(wǎng)絡(luò)獲得
加載的方法可以參考http://code.google.com/intl/zh-CN/apis/ajaxlibs/documentation/index.html#dojo
2、.在你自己的服務(wù)器上使用Dojo
a、下載最新的dojo包,地址:http://dojotoolkit.org/downloads;目前最新的包為1.3.1
b、解壓下載的壓縮文件
--dojo-release-1.3.1-src
----dijit
----dojo
----dojox
----util
c、可以通過D:\Apache-Source\dojo\1.3.1\dojo-release-1.3.1-src\dojo-release-1.3.1-src\dijit\themes\themeTester.html 這樣的路徑來查看相關(guān)的JS例子
3、每日構(gòu)建代碼
你可以通過SVN地址獲得
For instance, Dojo Core repository is:
http://svn.dojotoolkit.org/src/dojo/trunk
There are two versions of this view: anonymous and committer.
For users (readonly):
http://svn.dojotoolkit.org/src/view/anon/all/trunk
For committers (read/write):
https://svn.dojotoolkit.org/src/view/committer/all/trunk
第二部分 Ajax
第一個小節(jié) ajax
a、ajax and Dojo
1)XHR選項
例子:
// post some data, ignore the response: dojo.xhrPost({ form: "someFormId", // read the url: from the action="" of the <form> timeout: 3000, // give up after 3 seconds content: { part:"one", another:"part" } // creates ?part=one&another=part with GET, Sent as POST data when using xhrPost }); // get some data, convert to JSON dojo.xhrGet({ url:"data.json", handleAs:"json", load: function(data){ for(var i in data){ console.log("key", i, "value", data[i]); } } });
2)XHR回調(diào)
有三種方法可以附加到XHR選擇對象,以確定當(dāng)數(shù)據(jù)回調(diào)時該怎么做。