I need to give a 503 Service Unavailable HTTP header.
Normally I use these for 404 and 500 codes
throw new NotFoundException();
The Exceptions page in the Cake 2.0 book is worth a read.
Here's my short test:
// in bootstrap.php
require(APP . 'Lib' . DS . 'MyExceptions.php');
// in /Lib/MyExceptions.php
class ServiceUnavailableException extends CakeException {
protected $_messageTemplate = 'Test';
}
// in controller
throw new ServiceUnavailableException('Service unavailable', 503);
http://api22.cakephp.org/class/cake-response#method-CakeResponsestatusCode
Will allow you to set a status code.