private function __construct()
 {
     $this->sessionContext = SessionContext::instance();
     $this->pageContext = PageContext::instance();
     $this->requestContext = RequestContext::instance();
     $this->eventContext = EventContext::instance();
 }
 public function __construct($config = array())
 {
     parent::__construct($config);
     set_error_handler(array($this, 'errorHandler'));
     set_exception_handler(array($this, 'exceptionHandler'));
     $asp = isset($_GET['asp']) ? $_GET['asp'] : 'xul';
     $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
     $reRender = isset($_REQUEST['reRender']) ? $_REQUEST['reRender'] : null;
     $zoolForm = isset($_REQUEST['zoolForm']) ? $_REQUEST['zoolForm'] : null;
     Annotations::$config['cachePath'] = APP_PATH . '/runtime';
     // Zool specific annotations
     Annotations::getManager()->registry['scope'] = 'Annotation\\Standard\\ScopeAnnotation';
     Annotations::getManager()->registry['method'] = 'Annotation\\Standard\\MethodAnnotation';
     // obtaining the entity manager
     $em = $this->entityManager;
     if ($asp == 'xul') {
         $this->viewProvider = new ZXulViewProvider();
     } else {
         $this->viewProvider = new ZWebViewProvider();
     }
     /**
      * Input value binding
      */
     if ($zoolForm !== null && is_array($zoolForm)) {
         foreach ($zoolForm as $key => $value) {
             list($var, $scope) = explode(':', $key, 2);
             try {
                 if ($scope == UNSPECIFIED_SCOPE) {
                     $scope = EVENT_SCOPE;
                 }
                 Contexts::instance()->setToContext($scope, $var, $value);
             } catch (ZException $e) {
                 throw new ZException($e->getMessage());
             }
         }
     }
     if ($action !== null) {
         $methodExpression = PageContext::instance()->get($action);
         if ($methodExpression instanceof ZMethodExpression) {
             $methodExpression->run();
         }
         // there is no outputing
     }
     EventContext::instance()->reset();
     if ($reRender !== null) {
         $this->viewProvider->handleReRender();
     }
     if ($action !== null || $reRender !== null) {
         die;
     }
 }