           return router.handleErr(err, req, res) if err
 
           # Set any headers based on route.
-          res.set(router.getHeadersForRoute(routeInfo))
+          res.set(router.getHeadersForRoute(definition))
 
           res.type('html').end(html)
           router.stashPerf(req, "render", new Date - start)

      res.type('text').send(text)


  getHeadersForRoute: (routeInfo) ->
    headers = {}
    if routeInfo.maxAge?
      headers['Cache-Control'] = "public, max-age=#{routeInfo.maxAge}"
    headers

  # stash performance metrics, if handler available


  # Given an object with 'controller' and 'action' properties,
  # return the corresponding action function.
  getAction: (definition) ->
    controller = @getController(definition.controller)
    controller[definition.action]

  # This is the method that renders the request.
  getHandler: (action, definition) ->
    router = @

    (req, res, next) ->
