`
engineer
  • 浏览: 22985 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

初学flex3和rails2的问题

阅读更多
第一次写东西,请大家多多指教。
如题:总是提示如下错误:
发生ActionScript错误
[RPC Fault FaultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error:[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032:Stream Error.URL: http://localhost:3000/bugs/update"].URL: http://localhost:3000/bugs/update"]   
at mx.rpc::AbstractInvoker/http://www.adobe:com/2006/flex/mx/internal::faultHandler()
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault()
at flash.events::EventDispatcherdispatchEventFunction()
at.flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()

查看了一下,rails development/log,找到
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request_forgery_protection.rb这个文件,把其中的以下部分:
def verified_request?
        !protect_against_forgery?     ||
          request.method == :get      ||
          !verifiable_request_format? ||
          form_authenticity_token == params[request_forgery_protection_token]
      end
改写为:
def verified_request?
        !protect_against_forgery?     ||
          request.method == :post     ||
          request.method == :get      ||
          !verifiable_request_format? ||
          form_authenticity_token == params[request_forgery_protection_token]
      end

程序可正常运转。
3
0
分享到:
评论
4 楼 sina2009 2008-04-01  
我最近也在研究flex3与rails2

有可能的话,大家多多交流

3 楼 sina2009 2008-04-01  
这样子的话你就可以方便的XML数据与RAILS进行通信(采用REST接口)

同时也可以在使用HTML与AJAX的同时防止XRSS攻击
2 楼 sina2009 2008-04-01  
估计是request_forgery_protection的原因

但一般你不用去改的

一般RequestForgeryProtection只会对html及js类型的申请进行token检查

如果你使用的是flex端,你可以使用xml的形式发起请求:

比如:
<mx:HTTPService id="svcBugUpdate" result="handleBugsUpdateResult(event)" method="POST" resultFormat="e4x"/>

public function updateBug(bug:XML):void{
  var params:Object = new Object();
  params["bug[name]"] = "bugname";
  params["bug[body]"] = "bug body";
  params["_method"] = "PUT";
  svcBugUpdate.url = "/bugs/" + bug.id + ".xml";
  svcTaskUpdate.send(params);
}
1 楼 wangpeng198245ok 2008-03-08  
学习中..............

相关推荐

    Flexible Rails

    Flexible Rails(FLEX 3 on RAILS 2)是一种创新的技术组合,它结合了Ruby on Rails 强大的后端处理能力和Adobe Flex 在前端展示方面的优势,为开发人员提供了构建高性能Web应用的新途径。通过本书的学习,开发者...

    rails magazine issue 3

    结合 Rails 的后端能力和 Flex 的前端表现力,可以创建出功能强大且用户体验优秀的 Web 应用。 ##### 9. AASM:工作流解决方案 **知识点:** Chee Yeo 解释了如何使用 AASM(Active State Machine)来实现在 Ruby ...

    programming_flex.pdf

    3. **数据绑定**:Flex 2支持双向数据绑定,这使得开发者可以在模型和视图之间建立动态链接,当模型数据发生变化时,视图会自动更新。 4. **事件处理**:Flex 2采用事件驱动的架构,通过监听器机制来处理用户的交互...

    关于css排版的几点心得

    2. **定位机制**:CSS提供了三种定位机制:正常流(block layout)、浮动(float)和绝对定位(position: absolute)。正常流遵循从左到右、从上到下的排列方式;浮动用于创建多列布局,但可能导致父元素高度塌陷;...

Global site tag (gtag.js) - Google Analytics