Exemplo n.º 1
0
 public function processRequest(MMapRequest $request, MMapResponse $response)
 {
     self::$Logger->debug('Processing request: ' . $request);
     self::$CurrentRequest = $request;
     self::$CurrentResponse = $response;
     try {
         $managerFound = false;
         foreach ($this->getAllMMapManagers() as $MMapManagerName) {
             $myManager = call_user_func(array($MMapManagerName, 'getInstance'));
             if ($myManager->checkRequest($request)) {
                 $managerFound = true;
                 $myManager->processRequest($request, $response);
                 break;
             }
         }
         // default manager => draw initial screen
         if (!$managerFound) {
             $myManager = MMapScreen::getInstance();
             $myManager->processRequest($request, $response);
         }
     } catch (Exception $e) {
         $response->getHeaders()->append('Content-type:text/plain');
         self::$Logger->error('Uncaught exception while processing request: ' . $request);
         self::$Logger->error('Exception message: ' . $e->getMessage() . ' [' . $e->getFile() . ' - l.' . $e->getLine() . ']');
         self::$Logger->error(ExceptionStackUtil::getStackTrace($e, false));
         if ($e instanceof EyeSessionExpiredException) {
             $controlMessageBodyRenderer = new ControlMessageBodyRenderer(ControlMessageBodyRenderer::TYPE_SESSION_EXPIRED);
         } else {
             $controlMessageBodyRenderer = new ControlMessageBodyRenderer(ControlMessageBodyRenderer::TYPE_EXCEPTION, $e);
         }
         $response->setBodyRenderer($controlMessageBodyRenderer);
     }
     if (self::$Logger->isInfoEnabled()) {
         self::$Logger->info('Finished processing request: ' . $request . ', preparing to render response...');
         if (self::$Logger->isDebugEnabled()) {
             self::$Logger->debug((string) $response);
         }
     }
     $this->handleClientMessageQueue($response);
     $this->renderResponse($response);
     if (self::$Logger->isInfoEnabled()) {
         self::$Logger->info('Finished rendering response');
     }
 }