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).
# File railties/lib/dispatcher.rb, line 34
def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
if cgi ||= new_cgi(output)
request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
prepare_application
ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
end
rescue Object => exception
failsafe_response(output, '500 Internal Server Error', exception) do
ActionController::Base.process_with_exception(request, response, exception).out(output)
end
ensure
# Do not give a failsafe response here.
reset_after_dispatch
end