mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
parent
a9cb8bfb2c
commit
25abc16e15
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
namespace Icinga\Web;
|
namespace Icinga\Web;
|
||||||
|
|
||||||
use Zend_Controller_Action_HelperBroker;
|
|
||||||
use Zend_Controller_Response_Http;
|
use Zend_Controller_Response_Http;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use Icinga\Web\Response\JsonResponse;
|
||||||
|
|
||||||
class Response extends Zend_Controller_Response_Http
|
class Response extends Zend_Controller_Response_Http
|
||||||
{
|
{
|
||||||
@ -97,6 +97,16 @@ class Response extends Zend_Controller_Response_Http
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for HTTP responses in JSON format
|
||||||
|
*
|
||||||
|
* @return JsonResponse
|
||||||
|
*/
|
||||||
|
public static function json()
|
||||||
|
{
|
||||||
|
return new JsonResponse();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the request before sending
|
* Prepare the request before sending
|
||||||
*/
|
*/
|
||||||
@ -146,16 +156,4 @@ class Response extends Zend_Controller_Response_Http
|
|||||||
$this->prepare();
|
$this->prepare();
|
||||||
return parent::sendHeaders();
|
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…
x
Reference in New Issue
Block a user