Full Streaming Mode
Early Closing Mode
Polling Mode
在DWR应用中.默认启用的是Full Streaming Mode .它是三种modes中最快的一种.它每60秒检查一次浏览器是否是活跃的.配置很简单:
dwr-invokerorg.directwebremoting.servlet.DwrServletactiveReverseAjaxEnabledtrue
然后在要使用Reverse Ajax的页面使用
dwr.engine.setActiveReverseAjax(true);
即可...在2.0.4以后的版本中还要加入
maxWaitAfterWrite-1
因为在2.0.4版本中默认是使用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.
测试环境:IE8.0,Firefox 2.0,Windows xp sp2,Tomcat 6.0,MsSQL Server 2000
使用技术:Spring,Hibernate.Ext.DWR
用第一种配置的时候IE运行不了.报异常 "要完成操作的数据尚未准备好",Firefox可以.
第二种配置在maxWaitForWrite少于200的情况下IE运行正常,Firefox运行正常.
第三种配置只能打开一个连接.再想打开第二个则会报 java.lang.IllegaStateException:Cannot create a session after response has been commited
很是郁闷...若将maxWaitForWrite设置为100.则两个浏览器均没问题..但是浏览器久无刷新动作就无法从服务器调用客户端
这篇文章望抛砖引玉..各位讲下你们是如何配置的
posted on 2008-06-15 01:30 phyeas 阅读(988) 评论(1) 编辑 收藏