Beispiel #1
0
 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();
 }
Beispiel #2
0
 /**
  * Accept the Output object
  * and use it to set the
  * Content-Type header
  * and the body of response
  *
  *
  * @param Output $o instance of Output object
  */
 public function setOutput(Formatter $o)
 {
     $type = $o->getContentType();
     $this->contentType = $type;
     d('setting Content-Type header to: ' . $type);
     $this->setBody($o);
     return $this;
 }