diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 57529ee33..af389c331 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -78,10 +78,9 @@ class Dispatcher { public $request = null; /** - * The response object + * Response object used for asset/cached responses. * * @var CakeResponse - * @access public */ public $response = null; @@ -195,19 +194,20 @@ class Dispatcher { 'base' => $request->base ))); } - $output =& call_user_func_array(array(&$controller, $request->params['action']), $request->params['pass']); + $result =& call_user_func_array(array(&$controller, $request->params['action']), $request->params['pass']); + $response = $controller->getResponse(); if ($controller->autoRender) { $controller->render(); - } elseif ($this->response->body() === null) { - $this->response->body($output); + } elseif ($response->body() === null) { + $response->body($result); } $controller->shutdownProcess(); if (isset($request->params['return'])) { - return $this->response->body(); + return $response->body(); } - $this->response->send(); + $response->send(); } /** @@ -256,14 +256,9 @@ class Dispatcher { if (!$ctrlClass) { return $controller; } - if (!$this->response) { - $this->response = new CakeResponse(array( - 'charset' => Configure::read('App.encoding') - )); - } $ctrlClass .= 'Controller'; if (class_exists($ctrlClass)) { - $controller = new $ctrlClass($this->request, $this->response); + $controller = new $ctrlClass($this->request); } return $controller; }