lib: Add Request::sendJson()

refs #9606
This commit is contained in:
Eric Lippmann 2015-08-20 13:02:41 +02:00
parent 310dbdfde5
commit e07cdd21ac
1 changed files with 14 additions and 1 deletions

View File

@ -3,8 +3,9 @@
namespace Icinga\Web;
use Icinga\Application\Icinga;
use Zend_Controller_Action_HelperBroker;
use Zend_Controller_Request_Http;
use Icinga\Application\Icinga;
use Icinga\User;
/**
@ -124,4 +125,16 @@ class Request extends Zend_Controller_Request_Http
$cookie = new Cookie($this);
return $cookie->isSupported();
}
/**
* Immediately respond w/ the given data encoded in JSON
*
* @param array $data
*/
public function sendJson(array $data)
{
$helper = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
/** @var \Zend_Controller_Action_Helper_Json $helper */
$helper->sendJson($data);
}
}