CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • Dispatcher
  • DispatcherFilter
  • Router

Class DispatcherFilter

This abstract class represents a filter to be applied to a dispatcher cycle. It acts as as event listener with the ability to alter the request or response as needed before it is handled by a controller or after the response body has already been built.

DispatcherFilter implements CakeEventListener
Direct Subclasses
  • AssetDispatcher
  • CacheDispatcher
Abstract
Package: Cake\Routing
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Routing/DispatcherFilter.php

Properties summary

  • $priority public
    integer
    Default priority for all methods in this filter

Method Summary

  • afterDispatch() public

    Method called after the controller served a request and generated a response. It is posible to alter the response object at this point as it is not sent to the client yet.

  • beforeDispatch() public

    Method called before the controller is instantiated and called to ser a request. If used with default priority, it will be called after the Router has parsed the url and set the routing params into the request object.

  • implementedEvents() public

    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.

Method Detail

afterDispatch() public ¶

afterDispatch( CakeEvent $event )

Method called after the controller served a request and generated a response. It is posible 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 acheive the same result.

Parameters
CakeEvent $event

container object having the request and response keys in the data property.

Returns
mixed
boolean to stop the event dispatching or null to continue

beforeDispatch() public ¶

beforeDispatch( CakeEvent $event )

Method called before the controller is instantiated and called to ser a request. If used with default priority, it will be called after the Router has parsed the url and set the routing params into the request object.

If a CakeResponse object instance is returned, it will be served at the end of the event cycle, not calling any controller as a result. This will also have the effect of not calling the after event in the dispatcher.

If false is returned, the event will be stopped and no more listeners will be notified. Alternatively you can call $event->stopPropagation() to acheive the same result.

Parameters
CakeEvent $event

container object having the request, response and additionalParams keys in the data property.

Returns
CakeResponse|boolean

implementedEvents() public ¶

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.

Returns
array
Implementation of
CakeEventListener::implementedEvents()

Properties detail

$priority ¶

public integer

Default priority for all methods in this filter

10
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs