2008-12-10 72 views
1

我從Flash中收到2032流錯誤,以響應在IE(Firefox工作正常)中返回「201 Created」的POST請求。由於Flash不提供對HTTP狀態的訪問,我不能說它實際上已經成功。該請求正在使用HTTPService進行。Flex - 2032:僅在IE瀏覽器中出現流錯誤

有什麼建議嗎?有沒有人看過這個?

謝謝,亞歷克斯

回答

4

我在Flex on Rails應用程序中找到了解決這個問題的方法。我在IE中看到了同樣的問題 - 我在Rails中的development.log給出了201消息,但是這導致了返回給Flex的錯誤。我在一本名爲的新書中找到了一篇參考文獻,作者是Tony Hillerson和Daniel Wanja的第一頁上的Flex On Rails。它涉及捕捉201錯誤並更改標題。這是我的ApplicationController文件:

class ApplicationController < ActionController::Base 
    helper :all # include all helpers, all the time 
    include AuthenticatedSystem 
    before_filter :login_required 


    after_filter :flex_error_handling 
    def flex_error_handling 
    response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422) 
    response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201) 
    end 
    def rescue_action_in_public(exception) 
    render_exception(exception) 


    end 
    def rescue_action_locally(exception) 
    render_exception(exception) 
    end 
    rescue_from ActiveRecord::RecordNotFound, :with => :render_exception 
    def render_exception(exception) 
    render :text => "<errors><error>#{exception}</error></errors>", :status => 200 
    end 
end 

改變422個狀態消息,200的行爲是的Hillerman/Wanja的原始部分建議修改2032流錯誤到一些更友好,讓無效的記錄錯誤被送回Flex UI。

相關問題