Beispiel #1
0
 public function request($path)
 {
     $ext = strtolower(substr($path, strrpos($path, '.')));
     if (!isset($this->mime_types[$ext])) {
         return $this->notFound();
     }
     try {
         $asset = $this->manager->loader()->fromWebPath($path);
     } catch (Exceptions\FileNotFoundException $e) {
         // file not found => 404
         return $this->notfound();
     }
     if ($path !== $asset->getTargetPath()) {
         // file found but bad url => redirect
         return $this->redirectTo($asset->getTargetPath());
     }
     $this->send($this->mime_types[$ext], $asset->dump());
 }