public function __construct(Registry $Registry, Request $Request = null, $restful = true) { parent::__construct($Registry); $this->Request = null !== $Request ? $Request : $Registry->Request; $this->restful = $restful; $format = $this->Request->get('alt', 's', 'json'); d('requested output format: ' . $format); $callback = $this->Request->get('callback', 's', null); $this->Output = Output\Formatter::factory($format, $callback); $this->Registry->Response = Response::factory(); $this->aConfig = $Registry->Ini->getSection('API'); $this->pageID = $this->Request['pageID']; try { $this->initParams()->initClientUser()->setClientAppId()->makeAccessId()->checkLimit()->checkLoginStatus()->checkAccessPermission()->main(); $this->logRequest(); } catch (\Exception $e) { $this->handleException($e); } $this->prepareResponse(); }