web/lib/Zend/Controller/Plugin/Broker.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Controller
    16  * @package    Zend_Controller
    17  * @subpackage Plugins
    17  * @subpackage Plugins
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: Broker.php 20255 2010-01-13 13:23:36Z matthew $
    20  * @version    $Id: Broker.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /** Zend_Controller_Plugin_Abstract */
    23 /** Zend_Controller_Plugin_Abstract */
    24 require_once 'Zend/Controller/Plugin/Abstract.php';
    24 require_once 'Zend/Controller/Plugin/Abstract.php';
    25 
    25 
    26 /**
    26 /**
    27  * @category   Zend
    27  * @category   Zend
    28  * @package    Zend_Controller
    28  * @package    Zend_Controller
    29  * @subpackage Plugins
    29  * @subpackage Plugins
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    30  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    32  */
    32  */
    33 class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
    33 class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
    34 {
    34 {
    35 
    35 
   235         foreach ($this->_plugins as $plugin) {
   235         foreach ($this->_plugins as $plugin) {
   236             try {
   236             try {
   237                 $plugin->routeStartup($request);
   237                 $plugin->routeStartup($request);
   238             } catch (Exception $e) {
   238             } catch (Exception $e) {
   239                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   239                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   240                     throw $e;
   240                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   241                 } else {
   241                 } else {
   242                     $this->getResponse()->setException($e);
   242                     $this->getResponse()->setException($e);
   243                 }
   243                 }
   244             }
   244             }
   245         }
   245         }
   258         foreach ($this->_plugins as $plugin) {
   258         foreach ($this->_plugins as $plugin) {
   259             try {
   259             try {
   260                 $plugin->routeShutdown($request);
   260                 $plugin->routeShutdown($request);
   261             } catch (Exception $e) {
   261             } catch (Exception $e) {
   262                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   262                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   263                     throw $e;
   263                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   264                 } else {
   264                 } else {
   265                     $this->getResponse()->setException($e);
   265                     $this->getResponse()->setException($e);
   266                 }
   266                 }
   267             }
   267             }
   268         }
   268         }
   285         foreach ($this->_plugins as $plugin) {
   285         foreach ($this->_plugins as $plugin) {
   286             try {
   286             try {
   287                 $plugin->dispatchLoopStartup($request);
   287                 $plugin->dispatchLoopStartup($request);
   288             } catch (Exception $e) {
   288             } catch (Exception $e) {
   289                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   289                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   290                     throw $e;
   290                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   291                 } else {
   291                 } else {
   292                     $this->getResponse()->setException($e);
   292                     $this->getResponse()->setException($e);
   293                 }
   293                 }
   294             }
   294             }
   295         }
   295         }
   307         foreach ($this->_plugins as $plugin) {
   307         foreach ($this->_plugins as $plugin) {
   308             try {
   308             try {
   309                 $plugin->preDispatch($request);
   309                 $plugin->preDispatch($request);
   310             } catch (Exception $e) {
   310             } catch (Exception $e) {
   311                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   311                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   312                     throw $e;
   312                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   313                 } else {
   313                 } else {
   314                     $this->getResponse()->setException($e);
   314                     $this->getResponse()->setException($e);
       
   315 					// skip rendering of normal dispatch give the error handler a try
       
   316 					$this->getRequest()->setDispatched(false);
   315                 }
   317                 }
   316             }
   318             }
   317         }
   319         }
   318     }
   320     }
   319 
   321 
   329         foreach ($this->_plugins as $plugin) {
   331         foreach ($this->_plugins as $plugin) {
   330             try {
   332             try {
   331                 $plugin->postDispatch($request);
   333                 $plugin->postDispatch($request);
   332             } catch (Exception $e) {
   334             } catch (Exception $e) {
   333                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   335                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   334                     throw $e;
   336                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   335                 } else {
   337                 } else {
   336                     $this->getResponse()->setException($e);
   338                     $this->getResponse()->setException($e);
   337                 }
   339                 }
   338             }
   340             }
   339         }
   341         }
   351        foreach ($this->_plugins as $plugin) {
   353        foreach ($this->_plugins as $plugin) {
   352            try {
   354            try {
   353                 $plugin->dispatchLoopShutdown();
   355                 $plugin->dispatchLoopShutdown();
   354             } catch (Exception $e) {
   356             } catch (Exception $e) {
   355                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   357                 if (Zend_Controller_Front::getInstance()->throwExceptions()) {
   356                     throw $e;
   358                     throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
   357                 } else {
   359                 } else {
   358                     $this->getResponse()->setException($e);
   360                     $this->getResponse()->setException($e);
   359                 }
   361                 }
   360             }
   362             }
   361        }
   363        }