]> dev.renevier.net Git - syj.git/blobdiff - application/controllers/helpers/SyjApi.php
SyjNoRender helper
[syj.git] / application / controllers / helpers / SyjApi.php
index bfb97927d1a2aeb97d51573869a4a040308d2646..029fe90275eb79d3db7a7b026083265c6bedabb0 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
     and is published under the AGPL license. */
 
 class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_Abstract
@@ -11,12 +11,7 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
     protected $_redirect = '';
 
     public function init() {
-        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
-        $viewRenderer->setNoRender();
-        $layout = Zend_Layout::getMvcInstance();
-        if (null !== $layout) {
-            $layout->disableLayout();
-        }
+        $this->getActionController()->getHelper('SyjNoRender')->disableRender();
     }
 
     public function setContentType($contentType) {
@@ -78,8 +73,8 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
     public function postDispatch() {
         $response = $this->getResponse();
 
-        $response->setHeader('Content-Type', $this->_contentType)
-                 ->setHeader('Content-Length', strlen($this->_body));
+        $response->setHeader('Content-Type', $this->_contentType, true)
+                 ->setHeader('Content-Length', strlen($this->_body), true);
 
         if ($this->_checkIfNoneMatch) {
             $request = $this->getRequest();