/** * Sends the specified HTTP status immediately. * * NOTE: This method only supports web requests and will thrown an exception if used with other request types. * * @param int $statusCode The HTTP status code * @param string $statusMessage A custom HTTP status message * @param string $content Body content which further explains the status * @throws UnsupportedRequestTypeException If the request is not a web request * @throws StopActionException * @api */ public function throwStatus($statusCode, $statusMessage = null, $content = null) { if (!$this->request instanceof WebRequest) { throw new UnsupportedRequestTypeException('throwStatus() only supports web requests.', 1220539739); } if ($this->response instanceof \TYPO3\CMS\Extbase\Mvc\Web\Response) { $this->response->setStatus($statusCode, $statusMessage); if ($content === null) { $content = $this->response->getStatus(); } } $this->response->setContent($content); throw new StopActionException('throwStatus', 1476045871); }