| Class | DispatchServlet |
| In: |
vendor/rails/railties/lib/webrick_server.rb
|
| Parent: | WEBrick::HTTPServlet::AbstractServlet |
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.
| REQUEST_MUTEX | = | Mutex.new |
Start the WEBrick server with the given options, mounting the DispatchServlet at /.
# File vendor/rails/railties/lib/webrick_server.rb, line 50
50: def self.dispatch(options = {})
51: Socket.do_not_reverse_lookup = true # patch for OS X
52:
53: params = { :Port => options[:port].to_i,
54: :ServerType => options[:server_type],
55: :BindAddress => options[:ip] }
56: params[:MimeTypes] = options[:mime_types] if options[:mime_types]
57:
58: server = WEBrick::HTTPServer.new(params)
59: server.mount('/', DispatchServlet, options)
60:
61: trap("INT") { server.shutdown }
62: server.start
63: end