A custom dispatch servlet for use with WEBrick. It dispatches requests (using the Rails Dispatcher) to the appropriate controller/action. By default, it restricts WEBrick to a managing a single Rails request at a time, but you can change this behavior by setting ActionController::Base.allow_concurrency to true.
Methods
Public Class methods
Start the WEBrick server with the given options, mounting the DispatchServlet at /.
[ show source ]
# File railties/lib/webrick_server.rb, line 48
48: def self.dispatch(options = {})
49: Socket.do_not_reverse_lookup = true # patch for OS X
50:
51: params = { :Port => options[:port].to_i,
52: :ServerType => options[:server_type],
53: :BindAddress => options[:ip] }
54: params[:MimeTypes] = options[:mime_types] if options[:mime_types]
55:
56: server = WEBrick::HTTPServer.new(params)
57: server.mount('/', DispatchServlet, options)
58:
59: trap("INT") { server.shutdown }
60: server.start
61: end