public function run()
 {
     try {
         // routing.
         $uriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
         $connect = Lazy_Http_Dispatcher::dispatch($uriParts[0]);
         // create request/response objects.
         $request = $this->createRequest($connect['params']);
         $response = $this->createResponse();
         // call controller.
         require_once 'controllers/' . $connect['controller'] . '.php';
         $controller = new $connect['controller']();
         $controller->{$connect}['action']($request, $response);
     } catch (Exception $e) {
         $this->displayErrorPage($e);
     }
 }
 protected function redirectTo($controller, $action = 'index', $params = array())
 {
     header('Location: ' . Lazy_Http_Dispatcher::urlTo($controller, $action, $params));
     exit;
 }
 public static function setBase($base)
 {
     self::$base = $base;
 }