lib: Introduce Controller::httpNotFound()

Many actions require loading specific objects from database or any other storage.
If the object isn't found, Controller::httpNotFound($message) should be used
for immediately returning w/ HTTP 404.
This commit is contained in:
Eric Lippmann 2015-05-19 17:29:34 +02:00
parent bd54784496
commit 902c00e836
1 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Web;
use Zend_Controller_Action_Exception;
use Icinga\Data\Sortable;
use Icinga\Data\QueryInterface;
use Icinga\Web\Controller\ModuleActionController;
@ -49,6 +50,18 @@ class Controller extends ModuleActionController
}
}
/**
* Immediately respond w/ HTTP 404
*
* @param $message
*
* @throws Zend_Controller_Action_Exception
*/
public function httpNotFound($message)
{
throw new Zend_Controller_Action_Exception($message, 404);
}
/**
* Create a SortBox widget and apply its sort rules on the given query
*