Class: Jettr::Handler::Rails
- Defined in:
- lib/jettr/handler/rails.rb
Instance Attribute Summary
Attributes inherited from WebApp
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Rails
constructor
A new instance of Rails.
Constructor Details
#initialize(options = {}) ⇒ Rails
Returns a new instance of Rails.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jettr/handler/rails.rb', line 6 def initialize(={}) super() config.rails.set_default(:root, '/') config.rails.set_default(:public, '/public') config.rails.set_default(:min_runtimes, 1) config.rails.set_default(:max_runtimes, 3) config.rails.set_default(:environment, "development") self.add_filter("org.jruby.rack.RackFilter", "/*", org.mortbay.jetty.Handler::DEFAULT) self.resource_base = "#{config.app_path}" self.add_event_listener(Jettr::Rack::RailsServletContextListener.new) rack_params = java.util.HashMap.new({ 'rails.env' => config.rails.environment, 'rails.root' => config.rails.root, 'public.root' => config.rails.public, 'org.mortbay.jetty.servlet.Default.relativeResourceBase' => '/public', 'jruby.min.runtimes' => config.rails.min_runtimes.to_s, 'jruby.max.runtimes' => config.rails.max_runtimes.to_s, 'jruby.initial.runtimes' => config.rails.min_runtimes.to_s }) self.set_init_params(rack_params) self.add_servlet(Jetty::ServletHolder.new(Jetty::DefaultServlet.new), "/") end |