DWR的severlet配置及dwr.xml配置

       <servlet>
		<servlet-name>dwr-invoker</servlet-name>
		<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
		<!-- 防止DWR CSRF Security Error 添加参数crossDomainSessionSecurity和allowScriptTagRemoting-->  
        <init-param>  
            <param-name>crossDomainSessionSecurity</param-name>  
            <param-value>false</param-value>  
        </init-param>  
        <init-param>  
            <param-name>allowScriptTagRemoting</param-name>  
            <param-value>true</param-value>  
        </init-param> 
        <!-- 阻止debugger模式-->
		<init-param>
			<param-name>debug</param-name>
			<param-value>false</param-value>
		</init-param>
		<!-- Comet方式 --> 
		<init-param>
			<param-name>activeReverseAjaxEnabled</param-name>
			<param-value>true</param-value>
		</init-param>
		<!-- 通知DWR 在应用程序启动时初始化 ReverseAjaxTracker 见配置dwr.xml -->  
		<init-param>
			<param-name>initApplicationScopeCreatorsAtStartup</param-name>
			<param-value>true</param-value>
		</init-param>
		<!-- 设置成true能增加服务器的加载能力,尽管DWR有保护服务器过载的机制 -->
		<init-param>
			<param-name>pollAndCometEnabled</param-name>
			<param-value>true</param-value>
		</init-param>
		<!-- 压缩dwr代码提高页面加载效率 -->
		<init-param>
			<param-name>scriptCompressed</param-name>
			<param-value>true</param-value>
		</init-param>
		<!-- 添加DWR的ScriptSessionManager -->
		<init-param>
			<param-name>org.directwebremoting.extend.ScriptSessionManager</param-name>
			<param-value>com.easou.listener.CustomerScriptSessionManager</param-value>
		</init-param>
		<!-- 采用polling方式 -->
		<init-param>
            <param-name>org.directwebremoting.extend.ServerLoadMonitor</param-name>
            <param-value>org.directwebremoting.impl.PollingServerLoadMonitor</param-value>
        </init-param>
        <!-- 每次polling所间隔的时间 -->
        <init-param>
            <param-name>disconnectedTime</param-name>
            <param-value>3000</param-value>
        </init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>


dwr.xml的内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" 
  "http://getahead.org/dwr/dwr20.dtd">
<dwr>  
  <allow>
    <create creator="spring" javascript="CustomerServiceControll"> 
      <param name="beanName" value="customerServiceDwrServlet"/>
    </create>
  </allow>  
</dwr>  

上面的参数可以是beanName也可是是直接指向class

你可能感兴趣的:(DWR的severlet配置及dwr.xml配置)