diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php index eca389daa..b8150a6b2 100644 --- a/library/Icinga/Web/Response.php +++ b/library/Icinga/Web/Response.php @@ -12,6 +12,13 @@ use Icinga\Web\Response\JsonResponse; */ 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 * @@ -47,6 +54,29 @@ class Response extends Zend_Controller_Response_Http */ 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 * @@ -204,6 +234,9 @@ class Response extends Zend_Controller_Response_Http if ($this->isReloadCss()) { $this->setHeader('X-Icinga-Reload-Css', 'now', true); } + if (($autoRefreshInterval = $this->getAutoRefreshInterval()) !== null) { + $this->setHeader('X-Icinga-Refresh', $autoRefreshInterval, true); + } } else { if ($redirectUrl !== null) { $this->setRedirect($redirectUrl->getAbsoluteUrl());