From 03d37a2d68c1940f65d5a65a51ae747955a5b075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Sun, 5 Mar 2006 18:59:58 +0000 Subject: Added new infrastructure support for REST webservices. By default application/xml posts are handled by creating a XmlNode object with the same name as the root element of the submitted xml. M$ ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data| node = REXML::Document.new(post) { node.root.name => node.root } end XmlSimple and Yaml web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functio$ request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type [Tobias Luetke] Closes #4081 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3777 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/cgi_ext/cgi_methods.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_controller/cgi_ext/cgi_methods.rb') diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb index a2ba601662..89f982f56f 100755 --- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb @@ -1,5 +1,6 @@ require 'cgi' require 'action_controller/vendor/xml_simple' +require 'action_controller/vendor/xml_node' # Static methods for parsing the query and request parameters that can be used in # a CGI extension class or testing in isolation. @@ -58,12 +59,7 @@ class CGIMethods #:nodoc: end def self.parse_formatted_request_parameters(format, raw_post_data) - case format - when :xml - return XmlSimple.xml_in(raw_post_data, 'ForceArray' => false) - when :yaml - return YAML.load(raw_post_data) - end + ActionController::Base.param_parsers[format].call(raw_post_data) || {} rescue Object => e { "exception" => "#{e.message} (#{e.class})", "backtrace" => e.backtrace, "raw_post_data" => raw_post_data, "format" => format } -- cgit v1.2.3