Title: [654] trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java: Rework invocation so that doing a puts doesn't destroy a request.
Revision
654
Author
olabini
Date
2007-06-22 10:39:26 -0400 (Fri, 22 Jun 2007)

Log Message

Rework invocation so that doing a puts doesn't destroy a request. Stdout shouldn't be used for result output

Modified Paths

Diff

Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java (653 => 654)


--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java	2007-06-22 14:26:11 UTC (rev 653)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java	2007-06-22 14:39:26 UTC (rev 654)
@@ -73,12 +73,9 @@
 
 	protected void dispatchRequest(Ruby runtime, HttpServletRequest request, HttpServletResponse response) throws Exception {
 		RubyIO stdin = new RubyIO(runtime, request.getInputStream());
-		RubyIO stdout = new RubyIO(runtime, new HttpOutput(response));
+		RubyIO output = new RubyIO(runtime, new HttpOutput(response));
 
         runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdin", stdin));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdout", stdout));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$>", stdout));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$defout", stdout));
 
 		// setup the environment
 		setupEnvironment(runtime, request);
@@ -98,8 +95,8 @@
 		if (dispatcher == null) throw new ServletException("The rails dispatcher could not be found");
 
 		// dispatch the request
-		Object[] args = { cgi };
-		JavaEmbedUtils.invokeMethod(runtime, dispatcher, "dispatch", args, void.class);
+		IRubyObject[] args = { cgi, ((RubyModule)((RubyModule)((RubyModule)(runtime.getModule("ActionController")).getConstant("CgiRequest")))).getConstant("DEFAULT_SESSION_OPTIONS"), output};
+        dispatcher.callMethod(runtime.getCurrentContext(), "dispatch", args);
 	}
 
 	protected IRubyObject createCgi(Ruby runtime) {
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to