ajax mode,DWR的三种Reverse Ajax Mode配置详解
Full Streaming Mode
Early Closing Mode
Polling Mode
在DWR應(yīng)用中.默認(rèn)啟用的是Full Streaming Mode .它是三種modes中最快的一種.它每60秒檢查一次瀏覽器是否是活躍的.配置很簡單:
dwr-invokerorg.directwebremoting.servlet.DwrServletactiveReverseAjaxEnabledtrue
然后在要使用Reverse Ajax的頁面使用
dwr.engine.setActiveReverseAjax(true);
即可...在2.0.4以后的版本中還要加入
maxWaitAfterWrite-1
因為在2.0.4版本中默認(rèn)是使用Early Closing Mode
Early Closing Mode:
在2.0.4以后的版本中不需要添加配置..而2.0.3以前的版本需要、添加
maxWaitAfterWrite500
If it is deemed unwise to hold connections open at all then DWR can use polling mode
org.directwebremoting.extend.ServerLoadMonitororg.directwebremoting.impl.PollingServerLoadMonitor
In polling mode the default poll rate is every 5 seconds. This can be customized using the following:
disconnectedTime60000
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運(yùn)行不了.報異常 "要完成操作的數(shù)據(jù)尚未準(zhǔn)備好",Firefox可以.
第二種配置在maxWaitForWrite少于200的情況下IE運(yùn)行正常,Firefox運(yùn)行正常.
第三種配置只能打開一個連接.再想打開第二個則會報?? java.lang.IllegaStateException:Cannot create a session after response has been commited
很是郁悶...若將maxWaitForWrite設(shè)置為100.則兩個瀏覽器均沒問題..但是瀏覽器久無刷新動作就無法從服務(wù)器調(diào)用客戶端
這篇文章望拋磚引玉..各位講下你們是如何配置的
posted on 2008-06-15 01:30 phyeas 閱讀(988) 評論(1) ?編輯 ?收藏
總結(jié)
以上是生活随笔為你收集整理的ajax mode,DWR的三种Reverse Ajax Mode配置详解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 金融服务标准落地的第一个城市
- 下一篇: 印尼盾最大面值是多少