private function createResourceResponse($filename)
    {
        $response = new Response();

        $filestats = stat($filename);

        $response->headers->set('Content-Type', MimeType::getInstance()->guess($filename));
        $response->headers->set('Content-Length', $filestats['size']);

        $response->setCache(array(
            'etag'          => basename($filename),
            'last_modified' => new \DateTime('@'.$filestats['mtime']),
            'public'        => 'public',
        ));

        $response->setContent(file_get_contents($filename));

        return $response;
    }
private function createResourceResponse($filename)
    {
        $response = new Response();

        $filestats = stat($filename);

        $response->headers->set('Content-Type', MimeType::getInstance()->guess($filename));
        $response->headers->set('Content-Length', $filestats['size']);

        $response->setCache(array(
            'etag'          => basename($filename),
            'last_modified' => new \DateTime('@'.$filestats['mtime']),
            'public'        => 'public',
        ));

        $response->setContent(file_get_contents($filename));

        return $response;
    }
private function createResourceResponse ( $ filename ) { $ response = new Response ( ) ; $ filestats = stat ( $ filename ) ; $ response -> headers -> set ( 'Content-Type' , MimeType :: getInstance ( ) -> guess ( $ filename ) ) ; $ response -> headers -> set ( 'Content-Length' , $ filestats [ 'size' ] ) ; $ response -> setCache ( array ( 'etag' => basename ( $ filename ) , 'last_modified' => new \ DateTime ( '@' . $ filestats [ 'mtime' ] ) , 'public' => 'public' , ) ) ; $ response -> setContent ( file_get_contents ( $ filename ) ) ; return $ response ; }
Create Response object for resource.

@param string $filename valid filepath (file exists and readable)

@return Response
Create Response object for resource .