lib/Response: Allow to control the auto-refresh interval
This commit is contained in:
parent
c963ee23ff
commit
78c1e17c20
|
@ -12,6 +12,13 @@ use Icinga\Web\Response\JsonResponse;
|
||||||
*/
|
*/
|
||||||
class Response extends Zend_Controller_Response_Http
|
class Response extends Zend_Controller_Response_Http
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Auto-refresh interval
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $autoRefreshInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set of cookies which are to be sent to the client
|
* Set of cookies which are to be sent to the client
|
||||||
*
|
*
|
||||||
|
@ -47,6 +54,29 @@ class Response extends Zend_Controller_Response_Http
|
||||||
*/
|
*/
|
||||||
protected $rerenderLayout = false;
|
protected $rerenderLayout = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the auto-refresh interval
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getAutoRefreshInterval()
|
||||||
|
{
|
||||||
|
return $this->autoRefreshInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the auto-refresh interval
|
||||||
|
*
|
||||||
|
* @param int $autoRefreshInterval
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setAutoRefreshInterval($autoRefreshInterval)
|
||||||
|
{
|
||||||
|
$this->autoRefreshInterval = $autoRefreshInterval;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the set of cookies which are to be sent to the client
|
* Get the set of cookies which are to be sent to the client
|
||||||
*
|
*
|
||||||
|
@ -204,6 +234,9 @@ class Response extends Zend_Controller_Response_Http
|
||||||
if ($this->isReloadCss()) {
|
if ($this->isReloadCss()) {
|
||||||
$this->setHeader('X-Icinga-Reload-Css', 'now', true);
|
$this->setHeader('X-Icinga-Reload-Css', 'now', true);
|
||||||
}
|
}
|
||||||
|
if (($autoRefreshInterval = $this->getAutoRefreshInterval()) !== null) {
|
||||||
|
$this->setHeader('X-Icinga-Refresh', $autoRefreshInterval, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($redirectUrl !== null) {
|
if ($redirectUrl !== null) {
|
||||||
$this->setRedirect($redirectUrl->getAbsoluteUrl());
|
$this->setRedirect($redirectUrl->getAbsoluteUrl());
|
||||||
|
|
Loading…
Reference in New Issue