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

常用链接

留言簿(2)

随笔档案

文章分类

文章档案

相册

搜索

  •  

最新评论

阅读排行榜

评论排行榜

Dwr的Reverse Ajax可分为两中基本的mode.一种是Active,另一种是Passive,在Active中又分为三种.
  • Full Streaming Mode
  • Early Closing Mode
  • Polling Mode
  • 在DWR应用中.默认启用的是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版本中默认是使用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.

    测试环境: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.则两个浏览器均没问题..但是浏览器久无刷新动作就无法从服务器调用客户端
    这篇文章望抛砖引玉..各位讲下你们是如何配置的

     

    参考资料:http://getahead.org/dwr/reverse-ajax/configuration

    posted on 2008-06-15 01:30 phyeas 阅读(1021) 评论(1)  编辑  收藏

    FeedBack:
    # re: DWR的三种Reverse Ajax Mode配置详解 2008-06-15 22:55 phyeas
    最后..把dwr半换成2.0.4,并使用默认配制,即:不使用maxWaitForWrite参数的配置.解决了..但是我没看明白官方的E文..到底属于Early Closing mode还是Full Streaming Mode..不过问题最终还是得到解决了..  回复  更多评论
      

    只有注册用户登录后才能发表评论。


    网站导航: