|
Re: [jruby-user] JRuby on Rails on WebSphere: msg#00216lang.jruby.user
Evidently WebSphere only allows you to use one of request.getParameter* or request.getInputStream, and something upstream is apparently calling one of the getParameter* methods. http://www-1.ibm.com/support/docview.wss?uid=swg21258204 http://mail-archives.apache.org/mod_mbox/commons-user/200401.mbox/%3C20040128090742.R55740@xxxxxxxxxxxxxxxxxxx%3E Rails/RailsServlet needed getInputStream to return a stream that had the parameters in it and that could be rewound. We changed it to pull parameters from $java_servlet_request if the input stream was empty but content-length > 0. Our patch to action_controller is attached. The only problem left is that the browser sometimes shows a blank page when it's supposed to, you know, show some content. It seems to be related to the "If-None-Matches", and only occur on repeated requests to the same page. -- Matt Stefan Magnus Landrø wrote: Matt,diff -ruw clean/actionpack-1.13.5.7919/lib/action_controller/request.rb patched/actionpack-1.13.5.7919/lib/action_controller/request.rb --- clean/actionpack-1.13.5.7919/lib/action_controller/request.rb Tue Nov 27 14:40:18 2007 +++ patched/actionpack-1.13.5.7919/lib/action_controller/request.rb Wed Nov 28 16:01:46 2007 @@ -267,8 +267,8 @@ # work with raw requests directly. def raw_post unless env.include? 'RAW_POST_DATA' - env['RAW_POST_DATA'] = body.read(content_length) - body.rewind if body.respond_to?(:rewind) + env['RAW_POST_DATA'] = body.read(content_length) || '' + begin ; body.rewind if body.respond_to?(:rewind) ; rescue ; end end env['RAW_POST_DATA'] end @@ -367,8 +367,12 @@ when Proc strategy.call(body) when :url_encoded_form + if body.blank? && !$java_servlet_request.nil? + self.class.translate_java_servlet_parameters + else self.class.clean_up_ajax_request_body! body self.class.parse_query_parameters(body) + end when :multipart_form self.class.parse_multipart_form_parameters(body, boundary, content_length, env) when :xml_simple, :xml_node @@ -400,6 +404,16 @@ end.compact UrlEncodedPairParser.new(pairs).result + end + + def translate_java_servlet_parameters + pairs = $java_servlet_request.getParameterNames.inject([]) do |result, name| + result + $java_servlet_request.getParameterValues(name).collect { |value| [name, value] } + end + UrlEncodedPairParser.new(pairs).result + rescue => e + RAILS_DEFAULT_LOGGER 'Error in translate_java_servlet_parameters: ' + e.message + "\n" + e.backtrace.join("\n") + {} end def parse_request_parameters(params) --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [jruby-user] Questions about JRuby in Maven repositories: 00216, asalant |
|---|---|
| Next by Date: | [jruby-user] Running Coverage Reports: 00216, Joseph Athman |
| Previous by Thread: | Re: [jruby-user] JRuby on Rails on WebSpherei: 00216, Stefan Magnus Landrø |
| Next by Thread: | [jruby-user] Running watir on jruby: 00216, Ricardo Trindade |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |