Peeking into the Rails 2.3.8, params parsing is handled by ActionContoller::ParamsParser, which is located in actionpack/lib/action_controller/params_parser.rb:
https://github.com/rails/rails/blob/240f4e944cd90fca138aba8467456043952110cc/actionpack/lib/action_controller/params_parser.rb ParamsParser is a Rack app which is autoloaded inside the ActionController module: https://github.com/rails/rails/blob/240f4e944cd90fca138aba8467456043952110cc/actionpack/lib/action_controller.rb#L60 So, I think you want a Rack app as Jeff suggested: class CustomXmlHandler def self.call(env) if env["PATH_INFO"] =~ /^\/big-xml-requests/ DatabaseObject.create :xml => request.raw_post [201, {"Content-Type" => "text/html"}, "XML saved"] else [404, {"Content-Type" => "text/html"}, "Not Found"] end end end Then, insert it as middleware before the built-in Rails params parser in config/environment.rb: configuration.middleware.insert_before ActionContoller::ParamsParser, CustomXmlHandler On Sat, Mar 17, 2012 at 7:26 PM, Jeff Schmitz <[email protected]> wrote: > Can you do this part as a rack app? > > Jeff > > On Mar 17, 2012, at 4:32 PM, Carson Gross <[email protected]> wrote: > >> According to my tests, yes, the parameter parsing happens before the >> before_filters are run. >> >> Thanks, >> Carson >> >> On Mar 17, 11:15 am, Jeff Schmitz <[email protected]> wrote: >>> Does Rails parse the body prior to any before_filters run? >>> >>> Jeff >>> >>> On Mar 17, 2012, at 12:57 PM, Carson Gross <[email protected]> wrote: >>> >>> >>> >>> >>> >>> >>> >>>> Hey Guys, >>> >>>> This is a rails question, so please ignore if that doesn't interest >>>> you. >>> >>>> Does anyone know if there is a way to make rails *not* parse the body >>>> of an XML post to a given controller method? I've been googling for >>>> an hour now and can't figure it out. Basically we've got some huge >>>> XML docs coming in and we'd like to just jam them into the database as >>>> text and then process them in the background using nokogiri. >>> >>>> Unfortunately, rails is still parsing them using REXML before they >>>> ever hit our controller which I just realized after a week of pulling >>>> my hair out: the perf issue doesn't show up in New Relic because all >>>> the processing time is *before* the request. >>> >>>> We could switch the body to something like CSV, but I'm hoping there >>>> is a way to tell rails to just not bother parsing the body, so we can >>>> just grab it with: >>> >>>> request.body.read >>> >>>> This is rails 2.3.8. >>> >>>> Thanks, >>>> Carson >>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Heroku" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group >>>> athttp://groups.google.com/group/heroku?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Heroku" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/heroku?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Heroku" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/heroku?hl=en. > -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
