Example #1
0
 /**
  * Handles any Errors
  * @param \Jazz\IRequest $request
  * @param \Jazz\AResponse $response
  */
 protected function handleError(\Jazz\IRequest $request, \Jazz\AResponse $response)
 {
     if ($response->hasExceptions()) {
         $request->set('errors', $response->getExceptions());
         $request->setComponent($this->getComponent());
         $request->setEvent($this->getEvent());
         $request->setRun(false);
         $response->clearExceptions();
     }
 }
Example #2
0
 /**
  * Executes the Request
  * @param \Jazz\IRequest $request
  * @param \Jazz\AResponse $response
  * @throws \Jazz\Application\Exception\MaxLoopCount
  * @precondition set the Finder in the Dispatcher
  */
 public function run(\Jazz\IRequest $request, \Jazz\AResponse $response)
 {
     $settings = $this->getSettings();
     if ($request->getApplication() === null) {
         $request->setApplication($settings->getDefaultApplication());
     }
     if ($request->getComponent() === null) {
         $request->setComponent($settings->getDefaultComponent());
     }
     if ($request->getEvent() === null) {
         $request->setEvent($settings->getDefaultEvent());
     }
     $settings->setApplication($request->getApplication());
     $settings->lock();
     $this->getFinder()->reset();
     $this->_preRun($request, $response);
     $this->dispatch($request, $response);
     $this->_postRun($request, $response);
     $ret = null;
     if ($settings->getReturnResponse()) {
         $ret = $response;
     } else {
         $response->send();
     }
     return $ret;
 }