Handles serving plugin assets in development mode.
This should not be used in production environments as it has sub-optimal performance when compared to serving files with a real webserver.
$cacheTime
protected string
$typeMap
protected array
__construct( array $options [] )
Constructor.
$options
optional [] __invoke( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , callable $next )
Serve assets if the path matches one.
$request
$response
$next
_getAssetFile( string $url )
Builds asset file path based off url
$url
deliverAsset( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , Cake\Filesystem\File $file )
Sends an asset file to the client
$request
$response
Cake\Filesystem\File
$file
getType( Cake\Filesystem\File $file )
Return the type from a File object
Cake\Filesystem\File
$file
isNotModified( Psr\Http\Message\ServerRequestInterface $request , Cake\Filesystem\File $file )
Check the not modified header.
$request
Cake\Filesystem\File
$file
protected array
A extension to content type mapping for plain text types.
Because finfo doesn't give useful information for plain text types, we have to handle that here.
[ 'css' => 'text/css', 'json' => 'application/json', 'js' => 'application/javascript', 'ico' => 'image/x-icon', 'eot' => 'application/vnd.ms-fontobject', 'svg' => 'image/svg+xml', 'html' => 'text/html', 'rss' => 'application/rss+xml', 'xml' => 'application/xml', ]
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Routing.Middleware.AssetMiddleware.html