static public Method

Dispatcher.dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)

Dispatch the given CGI request, using the given session options, and emitting the output via the given output. If you dispatch with your own CGI object be sure to handle the exceptions it raises on multipart requests (EOFError and ArgumentError).

Source Code

# File dispatcher.rb, line 35
def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
  controller = nil
  if cgi ||= new_cgi(output)
    request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
    prepare_application
    controller = ActionController::Routing::Routes.recognize(request)
    controller.process(request, response).out(output)
  end
rescue Exception => exception  # errors from CGI dispatch
  failsafe_response(output, '500 Internal Server Error', exception) do
    controller ||= ApplicationController rescue LoadError nil
    controller ||= ActionController::Base
    controller.process_with_exception(request, response, exception).out(output)
  end
ensure
  # Do not give a failsafe response here.
  reset_after_dispatch
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.