Development

/branches/1.0/lib/controller/sfFrontWebController.class.php

You must first sign up to be able to contribute.

root/branches/1.0/lib/controller/sfFrontWebController.class.php

Revision 8319, 2.0 kB (checked in by FabianLange, 7 years ago)

added some more information to non symfony exceptions. closes #2864

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Rev Date
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) 2004-2006 Sean Kerr <sean@code-box.org>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 /**
13  * sfFrontWebController allows you to centralize your entry point in your web
14  * application, but at the same time allow for any module and action combination
15  * to be requested.
16  *
17  * @package    symfony
18  * @subpackage controller
19  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
20  * @author     Sean Kerr <sean@code-box.org>
21  * @version    SVN: $Id$
22  */
23 class sfFrontWebController extends sfWebController
24 {
25   /**
26    * Dispatches a request.
27    *
28    * This will determine which module and action to use by request parameters specified by the user.
29    */
30   public function dispatch()
31   {
32     try
33     {
34       if (sfConfig::get('sf_logging_enabled'))
35       {
36         $this->getContext()->getLogger()->info('{sfController} dispatch request');
37       }
38
39       // reinitialize filters (needed for unit and functional tests)
40       sfFilter::$filterCalled = array();
41
42       // determine our module and action
43       $request    = $this->getContext()->getRequest();
44       $moduleName = $request->getParameter('module');
45       $actionName = $request->getParameter('action');
46
47       // make the first request
48       $this->forward($moduleName, $actionName);
49     }
50     catch (sfException $e)
51     {
52       if (sfConfig::get('sf_test'))
53       {
54         throw $e;
55       }
56
57       $e->printStackTrace();
58     }
59     catch (Exception $e)
60     {
61       if (sfConfig::get('sf_test'))
62       {
63         throw $e;
64       }
65
66       try
67       {
68         // wrap non symfony exceptions
69         $sfException = new sfException($e->getMessage().' in '.$e->getFile().' line '.$e->getLine());
70         $sfException->printStackTrace($e);
71       }
72       catch (Exception $e)
73       {
74         header('HTTP/1.0 500 Internal Server Error');
75       }
76     }
77   }
78 }
79
Note: See TracBrowser for help on using the browser.