/**
  * Redirects the web request to another uri.
  *
  * NOTE: This method only supports web requests and will thrown an exception if used with other request types.
  *
  * @param mixed $uri A string representation of a URI
  * @param integer $delay (optional) The delay in seconds. Default is no delay.
  * @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException If the request is not a web request
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
  * @api
  */
 protected function redirectToUri($uri, $delay = 0, $statusCode = 303)
 {
     if (!$this->request instanceof \TYPO3\CMS\Extbase\Mvc\Web\Request) {
         throw new \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException('redirect() only supports web requests.', 1220539735);
     }
     $this->objectManager->get('TYPO3\\CMS\\Extbase\\Service\\CacheService')->clearCachesOfRegisteredPageIds();
     $uri = $this->addBaseUriIfNecessary($uri);
     $escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
     $this->response->setContent('<html><head><meta http-equiv="refresh" content="' . (int) $delay . ';url=' . $escapedUri . '"/></head></html>');
     $this->response->setStatus($statusCode);
     $this->response->setHeader('Location', (string) $uri);
     throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException();
 }