Filters a request and tests whether it is a file in the webroot folder or not and serves the file to the client if appropriate.
$_cacheTime protected string$_priority protected integerDefault priority for all methods in this filter This filter should run before the request gets parsed by router
__construct( array $config = [] )
Constructor.
$config optional [] Cake\Routing\DispatcherFilter::__construct() _deliverAsset( Cake\Http\ServerRequest $request , Cake\Http\Response $response , string $assetFile , string $ext )
Sends an asset file to the client
Cake\Http\ServerRequest $request Cake\Http\Response $response $assetFile $ext Cake\Http\Response_getAssetFile( string $url )
Builds asset file path based off url
$url beforeDispatch( Cake\Event\Event $event )
Checks if a requested asset exists and sends it to the browser
Cake\Event\Event $event Cake\Http\Response|nullCake\Http\Exception\NotFoundExceptionCake\Routing\DispatcherFilter::beforeDispatch() afterDispatch( Cake\Event\Event $event )
Method called after the controller served a request and generated a response. It is possible to alter the response object at this point as it is not sent to the client yet.
If false is returned, the event will be stopped and no more listeners will be notified. Alternatively you can call $event->stopPropagation() to achieve the same result.
Cake\Event\Event $event container object having the request and response keys in the data property.
handle( Cake\Event\Event $event )
Handler method that applies conditions and resolves the correct method to call.
Cake\Event\Event $event implementedEvents( )
Returns the list of events this filter listens to. Dispatcher notifies 2 different events Dispatcher.before and Dispatcher.after. By default this class will attach preDispatch and postDispatch method respectively.
Override this method at will to only listen to the events you are interested in.
Cake\Event\EventListenerInterface::implementedEvents() matches( Cake\Event\Event $event )
Check to see if the incoming request matches this filter's criteria.
Cake\Event\Event $event _configDelete( string $key )
Deletes a single config key.
$key Cake\Core\Exception\Exception_configRead( string|null $key )
Reads a config key.
$key _configWrite( string|array $key , mixed $value , boolean|string $merge = false )
Writes a config key.
$key $value $merge optional false True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.
Cake\Core\Exception\Exceptionconfig( string|array|null $key = null , mixed|null $value = null , boolean $merge = true )
Gets/Sets the config.
Reading the whole config:
$this->config();
Reading a specific value:
$this->config('key'); Reading a nested value:
$this->config('some.nested.key'); Setting a specific value:
$this->config('key', $value); Setting a nested value:
$this->config('some.nested.key', $value); Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key optional null $value optional null $merge optional true Cake\Core\Exception\ExceptionconfigShallow( string|array $key , mixed|null $value = null )
Merge provided config with existing config. Unlike config() which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->configShallow('key', $value); Setting a nested value:
$this->configShallow('some.nested.key', $value); Updating multiple config settings at the same time:
$this->configShallow(['one' => 'value', 'another' => 'value']);
$key $value optional null getConfig( string|null $key = null , mixed $default = null )
Returns the config.
Reading the whole config:
$this->getConfig();
Reading a specific value:
$this->getConfig('key'); Reading a nested value:
$this->getConfig('some.nested.key'); Reading with default value:
$this->getConfig('some-key', 'default-value'); $key optional null $default optional null setConfig( string|array $key , mixed|null $value = null , boolean $merge = true )
Sets the config.
Setting a specific value:
$this->setConfig('key', $value); Setting a nested value:
$this->setConfig('some.nested.key', $value); Updating multiple config settings at the same time:
$this->setConfig(['one' => 'value', 'another' => 'value']);
$key $value optional null $merge optional true Cake\Core\Exception\Exceptionprotected integer
Default priority for all methods in this filter This filter should run before the request gets parsed by router
9
© 2005–present 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.8/class-Cake.Routing.Filter.AssetFilter.html