diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-04-14 15:52:23 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-04-14 15:52:23 -0500 |
commit | 4839fe2e8201835a53ab6c75528a613e8bf25bfb (patch) | |
tree | 55f5c3f76358fcbb28fca6ac9bcd915cbefac89a /actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb | |
parent | 1120aaceae95b95ef491ca226154500051b5fe38 (diff) | |
download | rails-4839fe2e8201835a53ab6c75528a613e8bf25bfb.tar.gz rails-4839fe2e8201835a53ab6c75528a613e8bf25bfb.tar.bz2 rails-4839fe2e8201835a53ab6c75528a613e8bf25bfb.zip |
Move bundled rack into ActionDispatch
Diffstat (limited to 'actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb b/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb new file mode 100644 index 0000000000..1018af64c7 --- /dev/null +++ b/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/handler.rb @@ -0,0 +1,48 @@ +module Rack + # *Handlers* connect web servers with Rack. + # + # Rack includes Handlers for Mongrel, WEBrick, FastCGI, CGI, SCGI + # and LiteSpeed. + # + # Handlers usually are activated by calling <tt>MyHandler.run(myapp)</tt>. + # A second optional hash can be passed to include server-specific + # configuration. + module Handler + def self.get(server) + return unless server + + if klass = @handlers[server] + obj = Object + klass.split("::").each { |x| obj = obj.const_get(x) } + obj + else + Rack::Handler.const_get(server.capitalize) + end + end + + def self.register(server, klass) + @handlers ||= {} + @handlers[server] = klass + end + + autoload :CGI, "rack/handler/cgi" + autoload :FastCGI, "rack/handler/fastcgi" + autoload :Mongrel, "rack/handler/mongrel" + autoload :EventedMongrel, "rack/handler/evented_mongrel" + autoload :SwiftipliedMongrel, "rack/handler/swiftiplied_mongrel" + autoload :WEBrick, "rack/handler/webrick" + autoload :LSWS, "rack/handler/lsws" + autoload :SCGI, "rack/handler/scgi" + autoload :Thin, "rack/handler/thin" + + register 'cgi', 'Rack::Handler::CGI' + register 'fastcgi', 'Rack::Handler::FastCGI' + register 'mongrel', 'Rack::Handler::Mongrel' + register 'emongrel', 'Rack::Handler::EventedMongrel' + register 'smongrel', 'Rack::Handler::SwiftipliedMongrel' + register 'webrick', 'Rack::Handler::WEBrick' + register 'lsws', 'Rack::Handler::LSWS' + register 'scgi', 'Rack::Handler::SCGI' + register 'thin', 'Rack::Handler::Thin' + end +end |