lib/merb/dispatcher.rb in merb-0.4.2 vs lib/merb/dispatcher.rb in merb-0.5.0

- old
+ new

@@ -1,41 +1,41 @@ module Merb class Dispatcher DEFAULT_ERROR_TEMPLATE = Erubis::MEruby.new((File.read( - File.join(MERB_ROOT, 'app/views/exceptions/internal_server_error.html.erb')) rescue "Internal Server Error!")) + File.join(Merb.root, 'app/views/exceptions/internal_server_error.html.erb')) rescue "Internal Server Error!")) class << self def use_mutex=(val) @@use_mutex = val end @@mutex = Mutex.new - @@use_mutex = ::Merb::Server.config[:use_mutex] + @@use_mutex = ::Merb::Config[:use_mutex] # This is where we grab the incoming request REQUEST_URI and use that in # the merb RouteMatcher to determine which controller and method to run. # Returns a 2 element tuple of: [controller, action] # # ControllerExceptions are rescued here and redispatched. # Exceptions still return [controller, action] def handle(http_request, response) start = Time.now request = Merb::Request.new(http_request) - MERB_LOGGER.info("Params: #{request.params.inspect}") - MERB_LOGGER.info("Cookies: #{request.cookies.inspect}") + Merb.logger.info("Params: #{request.params.inspect}") + Merb.logger.info("Cookies: #{request.cookies.inspect}") # user friendly error messages if request.route_params.empty? raise ControllerExceptions::BadRequest, "No routes match the request" elsif request.controller_name.nil? raise ControllerExceptions::BadRequest, "Route matched, but route did not specify a controller" end - MERB_LOGGER.debug("Routed to: #{request.route_params.inspect}") + Merb.logger.debug("Routed to: #{request.route_params.inspect}") # set controller class and the action to call klass = request.controller_class dispatch_action(klass, request.action, request, response) rescue => exception - MERB_LOGGER.error(Merb.exception(exception)) + Merb.logger.error(Merb.exception(exception)) exception = controller_exception(exception) dispatch_exception(request, response, exception) end private