隨筆 - 25  文章 - 32  trackbacks - 0
          <2008年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(2)

          隨筆檔案

          文章分類

          文章檔案

          相冊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          Dwr的Reverse Ajax可分為兩中基本的mode.一種是Active,另一種是Passive,在Active中又分為三種.
        1. Full Streaming Mode
        2. Early Closing Mode
        3. Polling Mode
        4. 在DWR應(yīng)用中.默認(rèn)啟用的是Full Streaming Mode .它是三種modes中最快的一種.它每60秒檢查一次瀏覽器是否是活躍的.配置很簡單:

          <servlet>
            
          <servlet-name>dwr-invoker</servlet-name>
            
          <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
            
          <init-param>
              
          <param-name>activeReverseAjaxEnabled</param-name>
              
          <param-value>true</param-value>
            
          </init-param>
          </servlet>
          然后在要使用Reverse Ajax的頁面使用
          dwr.engine.setActiveReverseAjax(true);
          即可...在2.0.4以后的版本中還要加入
          <init-param>
            
          <param-name>maxWaitAfterWrite</param-name>
            
          <param-value>-1</param-value>
          </init-param>
          因為在2.0.4版本中默認(rèn)是使用Early Closing Mode

          Early Closing Mode:
          在2.0.4以后的版本中不需要添加配置..而2.0.3以前的版本需要、添加
          <init-param>
            
          <param-name>maxWaitAfterWrite</param-name>
            
          <param-value>500</param-value>
          </init-param>

          If it is deemed unwise to hold connections open at all then DWR can use polling mode

           

          <init-param>
            
          <param-name>org.directwebremoting.extend.ServerLoadMonitor</param-name>
            
          <param-value>org.directwebremoting.impl.PollingServerLoadMonitor</param-value>
          </init-param>


          In polling mode the default poll rate is every 5 seconds. This can be customized using the following:

          <init-param>
            
          <param-name>disconnectedTime</param-name>
            
          <param-value>60000</param-value>
          </init-param>

          The example above will poll only once every 60 seconds (60,000 milliseconds). For many applications a response time of 60 seconds will be enough, and will allow a web server to handle a very large number of clients.

          測試環(huán)境:IE8.0,Firefox 2.0,Windows xp sp2,Tomcat 6.0,MsSQL Server 2000
          使用技術(shù):Spring,Hibernate.Ext.DWR
          用第一種配置的時候IE運行不了.報異常 "要完成操作的數(shù)據(jù)尚未準(zhǔn)備好",Firefox可以.
          第二種配置在maxWaitForWrite少于200的情況下IE運行正常,Firefox運行正常.
          第三種配置只能打開一個連接.再想打開第二個則會報   java.lang.IllegaStateException:Cannot create a session after response has been commited
          很是郁悶...若將maxWaitForWrite設(shè)置為100.則兩個瀏覽器均沒問題..但是瀏覽器久無刷新動作就無法從服務(wù)器調(diào)用客戶端
          這篇文章望拋磚引玉..各位講下你們是如何配置的

           

          參考資料:http://getahead.org/dwr/reverse-ajax/configuration

          posted on 2008-06-15 01:30 phyeas 閱讀(1037) 評論(1)  編輯  收藏

          FeedBack:
          # re: DWR的三種Reverse Ajax Mode配置詳解 2008-06-15 22:55 phyeas
          最后..把dwr半換成2.0.4,并使用默認(rèn)配制,即:不使用maxWaitForWrite參數(shù)的配置.解決了..但是我沒看明白官方的E文..到底屬于Early Closing mode還是Full Streaming Mode..不過問題最終還是得到解決了..  回復(fù)  更多評論
            

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 清水县| 泗洪县| 高雄县| 乐清市| 祥云县| 微山县| 玉树县| 崇仁县| 湘潭县| 玛沁县| 宕昌县| 嘉义县| 迁西县| 寿阳县| 宣化县| 肥乡县| 宣武区| 毕节市| 宝丰县| 蚌埠市| 唐山市| 永清县| 永寿县| 潜江市| 奉化市| 镇雄县| 文水县| 来凤县| 林芝县| 九江市| 桐梓县| 星座| 沂水县| 水城县| 若羌县| 辛集市| 伊春市| 通榆县| 遂昌县| 大庆市| 乌海市|