public function __construct() { parent::__construct(); $authAdapter = new tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest()); try { $user = $authAdapter->authenticate(); $session = new common_session_RestSession($user); \common_session_SessionManager::startSession($session); } catch (common_user_auth_AuthFailedException $e) { $this->requireLogin(); } /* $this->headers = tao_helpers_Http::getHeaders(); $this->files = tao_helpers_Http::getFiles(); */ if ($this->hasHeader("Accept")) { try { $this->responseEncoding = tao_helpers_Http::acceptHeader($this->acceptedMimeTypes, $this->getHeader("Accept")); } catch (common_exception_ClientException $e) { $this->returnFailure($e); } } if ($this->hasHeader("Accept-Language")) { try { } catch (common_exception_ClientException $e) { $this->returnFailure($e); } } header('Content-Type: ' . $this->responseEncoding); //check auth method requested /**/ }
/** * Check response encoding requested * * tao_actions_RestModule constructor. */ public function __construct() { if ($this->hasHeader("Accept")) { try { $this->responseEncoding = tao_helpers_Http::acceptHeader($this->getAcceptableMimeTypes(), $this->getHeader("Accept")); } catch (common_exception_ClientException $e) { $this->returnFailure($e); } } header('Content-Type: ' . $this->responseEncoding); }