/**
  * 创建并执行当前应用,单应用访问入口
  */
 public function run()
 {
     $this->_app = $this->createApplication($this->_config['web-apps'][$this->_appName], WindFactory::_getInstance());
     set_error_handler(array($this, '_errorHandle'), error_reporting());
     set_exception_handler(array($this, '_exceptionHandle'));
     if ($this->_config['isclosed']) {
         throw new Exception('Sorry, Site has been closed!');
     }
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onCreate');
     }
     /* @var $router WindRouter */
     $router = $this->_app->getFactory()->getInstance('router');
     $router->route($this->_app->getRequest());
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onStart');
     }
     $this->_app->run($router);
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onResponse');
     }
     $this->_app->getResponse()->sendResponse();
     $this->_app->getFactory()->executeDestroyMethod();
     restore_error_handler();
     restore_exception_handler();
 }
 /**
  * 创建并运行当前应用
  * 
  * 配合过滤链策略部署,可以通过{@see AbstractWindFrontController::registeFilter}
  * 方法注册过滤器,当应用被执行时会判断当前时候有初始化过滤链对象,并选择是否是通过过滤链方式执行应用
  * @return void
  */
 protected function _run()
 {
     $application = $this->createApplication();
     if ($this->_chain !== null) {
         $this->_chain->setCallBack(array($application, 'run'), array(true));
         $this->_chain->getHandler()->handle($this);
     } else {
         $application->run($application->getConfig('filters'));
     }
     restore_error_handler();
     restore_exception_handler();
     $this->_app->getResponse()->sendResponse();
     $this->_app->getWindFactory()->executeDestroyMethod();
     if ($this->_cache !== null && $this->_cached === false) {
         $this->_cache->set('factory', $this->_factory);
         $this->_cache->set('classes', Wind::$_classes);
         $this->_cache->set('imports', Wind::$_imports);
         $this->_cache->set('config', $this->_config);
     }
 }