`
engineer
  • 浏览: 22187 次
  • 性别: 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: Flex3 on Rails2

    Flex在Rich Internet Applications应用的开发上具有非常强的生产效率,而Rails在创建一个基于...Peter Armstrong专门针对这个问题写了《Flexible Rails: Flex 3 on Rails 2》,对如何配合使用作了一个比较全面地介绍。

    Flex3与Rails结合

    Flex3与Rails结合的HelloWord

    flex on rails

    flexible rails , Flex on Rails, Flex3 on Rails2.英文版

    flex on rails文档

    该文档简要介绍了如何在rails中使用flex,并提供了flex on rails的相关资源地址

    Flex.3实战(中文版)

    《Flex3实战》首先简要概述Flex 3和ActionScript,然后以十分友好、务实的方式介绍Flex的每个主要...Flex 3提供企业质量的数据以及与Java、PHP和Rails集成的服务器组件。目前,Flex的主要组件是供免费使用的开源软件!

    rails2-sample

    rails2-sample good book

    flex 與 rails 開發的問題單管理sample

    flex 與 rails 開發的問題單管理sample,內附詳細的說明,容易建置與使用

    flex rails

    一個前端介面為flex程式部份為ruby on rails架構的書

    Flexible Rails

    Flexible Rails FLEX 3 ON RAILS 2

    jquery-rails, 一个 gem,用于自动使用jQuery和 Rails 3.zip

    jquery-rails, 一个 gem,用于自动使用jQuery和 Rails 3 railsjQuery 面向 Rails 如此伟大。这里 gem 提供:jQuery 1.7.2jQuery UI 1.8.18 ( 仅适用于 javascript )jQuery UJS适配器assert_select_j

    rails3教程

    Rails3教程系列 DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY...

    Ruby on Rails Guides v2 - Ruby on Rails 4.2.5

    Ruby on Rails Guides v2 - Ruby on Rails 4.2.5

    RVM_Ruby1.9.3_Rails3(2-Ruby on Rails3安装配置)

    Windows7_Cygwin_Git_RVM_Ruby1.9.3_Rails3_MongoD B_Nginx_Unicorn_Rspec_Guard_Spork(2-Ruby on Rails3 安装配置

    Rails 3 in Action

    Rails 3 in Action 2011年9月新鲜出炉,针对最新的Rails 3.1进行说明

    rails金典教材3本

    Ruby+on+Rails+3+Tutorial.pdf 应用Rails进行敏捷Web开发第4版.pdf (Agile Web Development with Rails) Rails.Recipes.Rails.3.Edition.pdf

    Hello! Flex 4

    Peter is also the author of the Manning book Flexible Rails: Flex 4 on Rails 2. He was a key part of the team that won the 2006 Adobe MAX Award for RIA/Web Development, the organizer of the Vancouver...

    The Rails 3 Way(2nd)

    The Rails™ 3 Way is a comprehensive resource that digs into the new features in Rails 3 and perhaps more importantly, the rationale behind them. —Yehuda Katz, Rails Core The Bible for Ruby on ...

    Rails 101S

    初学 Ruby on Rails 必备之宝典

    Ruby-ForemRails3和Rails4论坛引擎

    Forem - Rails 3和Rails 4论坛引擎

    Ruby for Rails

    Ruby for Rails 英文原版, pdf格式 &lt;br&gt;本书是一部专门为Rails实践而写的经典Ruby著作,由四部分组成,共17章... 本书适合于Ruby的初学者,也适合于想要进一步提高Ruby编程技能,开发实际Rails应用的Web程序员。

Global site tag (gtag.js) - Google Analytics