当前位置:首页 > 开发 > Web前端 > 前端 > 正文

DWR2跨域访问异常【A request has been denied as a potential CSRF attack】

发表于: 2014-11-09   作者:xianddd   来源:转载   浏览:
DWR
摘要: 异常: A request has been denied as a potential CSRF attack java.lang.SecurityException, Session Error 发生:升级dwr2、tomcat7、weblogic11、jsp中dwr路径问题 解决: 1、添加跨域访问参数 <servlet>    &nb

异常:

A request has been denied as a potential CSRF attack

java.lang.SecurityException, Session Error

发生:升级dwr2、tomcat7、weblogic11、jsp中dwr路径问题

解决:

1、添加跨域访问参数

<servlet>

         <servlet-name>dwr-invoker</servlet-name>

         <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>

         <init-param>

                   <param-name>debug</param-name>

                   <param-value>true</param-value>

         </init-param>

         <!-- 开启跨域调用 -->

         <init-param>      

             <param-name>crossDomainSessionSecurity</param-name>      

             <param-value>false</param-value>      

         </init-param>

</servlet>

2、调整jsp的dwr路径:

测试页面的路径:/Struts12/WebRoot/dwrDemo/index.jsp

调整前:

<script type="text/javascript" src="dwr/engine.js"></script>

<script type="text/javascript" src="dwr/util.js"></script>

<script type="text/javascript" src="dwr/interface/UserService.js"></script>

调整后,访问正常:

<script type="text/javascript" src="../dwr/engine.js"></script>

<script type="text/javascript" src="../dwr/util.js"></script>

<script type="text/javascript" src="../dwr/interface/UserService.js"></script>

 

 

 

 

【】

DWR2跨域访问异常【A request has been denied as a potential CSRF attack】

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号