diff --git a/library/Icinga/Web/Request.php b/library/Icinga/Web/Request.php index b4d7e92d4..3f9a6a506 100644 --- a/library/Icinga/Web/Request.php +++ b/library/Icinga/Web/Request.php @@ -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); + } }