Q. What is the responsibility of the Front Controller?
Directly receive the request from the browser.
All requests call the function Mage_Core_Controller_Varien_Front::dispatch()
- URL rewriting process.
- Load the module and action controller corresponding with the requests through routers to process the requirements which are sent from clients.
Collect routers: admin, standard, default.
Use the function match() of routers to define the module and controller that are requested.
Call the function dispatch() of the controller requested.
Call the action requested.
- Return HTML for browser
$this->getResponse()->sendResponse(),
Call the function sendResponse() of Mage_Core_Model_Response_Http (extend from Zend_Controller_Response_Abstract).
Call the function sendHeaders() – use the header() function of PHP.
Call the function outputBody() to show the whole content of the body part:
echo implode(”, $this->_body);