Title: [721] trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java: Expose $java_servlet_request and $java_servlet_response
- Revision
- 721
- Author
- tantalon
- Date
- 2007-08-27 17:41:41 -0400 (Mon, 27 Aug 2007)
Log Message
Expose $java_servlet_request and $java_servlet_response
Modified Paths
Diff
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java (720 => 721)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java 2007-08-27 06:08:38 UTC (rev 720)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java 2007-08-27 21:41:41 UTC (rev 721)
@@ -75,10 +75,14 @@
RubyIO stdin = new RubyIO(runtime, request.getInputStream());
RubyIO output = new RubyIO(runtime, new HttpOutput(response));
- runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdin", stdin));
-
// setup the environment
setupEnvironment(runtime, request);
+
+ // variables to expose
+ runtime.defineReadonlyVariable("$stdin", stdin);
+ runtime.defineReadonlyVariable("$java_servlet_request", JavaEmbedUtils.javaToRuby(runtime, request));
+ runtime.defineReadonlyVariable("$java_servlet_response", JavaEmbedUtils.javaToRuby(runtime, response));
+ // $servlet_context is added when the runtime is created
// setup the default session
String value = getServletContext().getInitParameter("jruby.session_store");
@@ -95,8 +99,9 @@
if (dispatcher == null) throw new ServletException("The rails dispatcher could not be found");
// dispatch the request
- IRubyObject[] args = { cgi, ((RubyModule)((RubyModule)((RubyModule)(runtime.getModule("ActionController")).getConstant("CgiRequest")))).getConstant("DEFAULT_SESSION_OPTIONS"), output};
- dispatcher.callMethod(runtime.getCurrentContext(), "dispatch", args);
+ RubyHash sessionOptions = getDefaultSessionOptions(runtime);
+ IRubyObject[] args = { cgi, sessionOptions, 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