parent
a9cb8bfb2c
commit
25abc16e15
|
@ -3,9 +3,9 @@
|
|||
|
||||
namespace Icinga\Web;
|
||||
|
||||
use Zend_Controller_Action_HelperBroker;
|
||||
use Zend_Controller_Response_Http;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Response\JsonResponse;
|
||||
|
||||
class Response extends Zend_Controller_Response_Http
|
||||
{
|
||||
|
@ -97,6 +97,16 @@ class Response extends Zend_Controller_Response_Http
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for HTTP responses in JSON format
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public static function json()
|
||||
{
|
||||
return new JsonResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the request before sending
|
||||
*/
|
||||
|
@ -146,16 +156,4 @@ class Response extends Zend_Controller_Response_Http
|
|||
$this->prepare();
|
||||
return parent::sendHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue