Sha256: bc5a9eefe9cb4d145f47cd821573eadb61742f59fb1ae817163cb29941d660a6

Contents?: true

Size: 1.33 KB

Versions: 28

Compression:

Stored size: 1.33 KB

Contents

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 :WEBrick, "rack/handler/webrick"
    autoload :LSWS, "rack/handler/lsws"
    autoload :SCGI, "rack/handler/scgi"

    register 'cgi', 'Rack::Handler::CGI'
    register 'fastcgi', 'Rack::Handler::FastCGI'
    register 'mongrel', 'Rack::Handler::Mongrel'
    register 'emongrel', 'Rack::Handler::EventedMongrel'
    register 'webrick', 'Rack::Handler::WEBrick'
    register 'lsws', 'Rack::Handler::LSWS'
    register 'scgi', 'Rack::Handler::SCGI'
  end
end

Version data entries

28 entries across 28 versions & 6 rubygems

Version Path
3mix-castronaut-0.5.0.2 vendor/rack/lib/rack/handler.rb
masover-castronaut-0.4.4.4 vendor/rack/lib/rack/handler.rb
masover-castronaut-0.4.4.5 vendor/rack/lib/rack/handler.rb
masover-castronaut-0.5.0.1 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.2.0 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.2.5 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.3.0 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.3.5 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.3.6 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.1 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.2 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.3 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.4 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.5 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.4.6 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.5.0 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.5.1 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.5.2 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.5.3 vendor/rack/lib/rack/handler.rb
relevance-castronaut-0.5.4 vendor/rack/lib/rack/handler.rb