Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread
Message: 89706
BY: John Lloyd-Jones (johnlloydjones)
DATE: 2009-08-17 20:59
SUBJECT: RE: What needs to happen in config.ru?

 

Well, I think I know why it won't work:

Deep down in the grizzly-ruby.jar, I find this:

public IRubyObject createApplicationObject(Ruby runtime)
{
IRubyObject app = runtime.evalScriptlet(creationString);
runtime.defineReadonlyVariable("$glassfish_app", app);
return runtime.evalScriptlet("Rack::Handler::Grizzly.new($glassfish_app)");
}

Now Rack::Handler::Grizzly is a ruby class class (it's in the same jar) that looks like this:

module Rack
module Handler
class Grizzly
def initialize(rack_app)
@rack_app = rack_app
end
def self.run (rack_app, *args)
@rack_app = rack_app
$grizzly_rack_app = rack_app
#Look at me, I'm a dummy method
end
def self.stop
#I'm another dummy method
end
def self.method_missing (m, *args)
puts "Someone tried to call #{m} on Rack::Handler::Grizzly!"
end
def call(env)
JRuby::Rack::Response.new(@rack_app.call(env))
end
end
end
end

What is really needed would be:

evalScriptlet("Rack::Builder.new($glassfish_app)")

because that puts you in the context of the the rack Builer class. FWIW, this is what jruby-rack has in the corresponding place:

evalScriptlet("load 'jruby/rack/boot/rack.rb'\n" + "Rack::Handler::Servlet.new(Rack::Builder.new {(" + rackup + "\n )}.to_app)");

(of course the Servlet class wrapper wouldn't apply to the glassfish gem).

Interestingly, the source code for the glassfish gem has disappeared from the repository. I had to use a decompiler to get the source.


Thread View

Thread Author Date
What needs to happen in config.ru?James Britt2009-08-13 02:30
      RE: What needs to happen in config.ru?James Britt2009-08-13 02:59
            RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-15 00:23
                  RE: What needs to happen in config.ru?James Britt2009-08-15 02:20
                        RE: What needs to happen in config.ru?James Britt2009-08-15 02:50
                              RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-15 02:59
                        RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-15 02:53
                              RE: What needs to happen in config.ru?James Britt2009-08-15 17:41
                                    RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-16 14:42
                                          RE: What needs to happen in config.ru?James Britt2009-08-16 23:45
                                                RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-17 21:27
                                                RE: What needs to happen in config.ru?John Lloyd-Jones2009-08-17 20:59
                                                      RE: What needs to happen in config.ru?James Britt2009-08-17 21:43
                                                            RE: What needs to happen in config.ru?Vivek Pandey2009-08-18 20:30
                                                                  RE: What needs to happen in config.ru?James Britt2009-08-18 21:11
                                                                        RE: What needs to happen in config.ru?Vivek Pandey2009-08-18 21:50
                                                                              RE: What needs to happen in config.ru?James Britt2009-08-19 00:29

Post a followup to this message