// Get default command
$commandName = $responseInstance->getDefaultCommand();
+ // Default is 'page'
+ $element = 'page';
+
+ // Is the request type console?
+ if ($responseType === 'console') {
+ // Console applications have only commands
+ $element = 'command';
+ } // END - if
+
// Set it in request
- $requestInstance->setRequestElement('command', $commandName);
+ $requestInstance->setRequestElement($element, $commandName);
} // END - if
// Get a controller resolver
// CFG: DEFAULT-CITY-HTML-COMMAND
$cfg->setConfigEntry('default_city_html_command', 'home');
-// CFG: HTML-CMD-HOME-RESOLVER-CLASS
-$cfg->setConfigEntry('html_cmd_home_resolver_class', 'CityHtmlCommandResolver');
+// CFG: CITY-HTML-CMD-HOME-RESOLVER-CLASS
+$cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolver');
-// CFG: HTML-CMD-REGISTER-RESOLVER-CLASS
-$cfg->setConfigEntry('html_cmd_register_resolver_class', 'CityHtmlCommandResolver');
+// CFG: CITY-HTML-CMD-REGISTER-RESOLVER-CLASS
+$cfg->setConfigEntry('city_html_cmd_register_resolver_class', 'CityHtmlCommandResolver');
// CFG: NEWS-READER-REGISTER-CLASS
$cfg->setConfigEntry('news_reader_register_class', 'DefaultNewsReader');
* Console client *
******************************************************************************/
+// CFG: DEFAULT-CONSOLE-COMMAND
+$cfg->setConfigEntry('default_console_command', 'daemon');
+
// CFG: DEFAULT-CITY-CONSOLE-COMMAND
$cfg->setConfigEntry('default_city_console_command', 'daemon');
// CFG: CITY-SHUTDOWN-CITY-FILTER
$cfg->setConfigEntry('city_shutdown_city_filter', 'CityShutdownCityFilter');
+// CFG: NEWS-READER-DAEMON-CLASS
+$cfg->setConfigEntry('news_reader_daemon_class', 'ConsoleNewsReader');
+
// CFG: NEWS-DAEMON-LIMIT
$cfg->setConfigEntry('news_daemon_limit', 5);
* @return void
*/
public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
- // Get the command instance from the resolver by sending a request instance to the resolver
- $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
-
- // Add more filters by the command
- $commandInstance->addExtraFilters($this, $requestInstance);
-
- // Run the pre filters
- $this->executePreFilters($requestInstance, $responseInstance);
-
- // This request was valid! :-D
- $requestInstance->requestIsValid();
-
- // Execute the command
- $commandInstance->execute($requestInstance, $responseInstance);
-
- // Run the pre filters
- $this->executePostFilters($requestInstance, $responseInstance);
-
- // Flush the response out
- $responseInstance->flushBuffer();
- }
-
- /**
- * Add a shutdown filter
- *
- * @param $filterInstance A Filterable class
- * @return void
- */
- public function addShutdownFilter (Filterable $filterInstance) {
- $this->addFilter('shutdown', $filterInstance);
- }
-
- /**
- * Executes all shutdown filters
- *
- * @param $requestInstance A Requestable class
- * @param $responseInstance A Responseable class
- * @return void
- */
- public function executeShutdownFilters (Requestable $requestInstance, Responseable $responseInstance) {
- $this->executeFilters('shutdown', $requestInstance, $responseInstance);
+ // Generic pre-post command execution
+ $this->executeGenericPrePostCommand($requestInstance, $responseInstance);
}
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set prefix to 'Html'
- $this->setClassPrefix('html');
+ // Set prefix to 'city_html'
+ $this->setClassPrefix('city_html');
}
/**
-Subproject commit 64d9752d26925eb4389f478362e84e77dee6057a
+Subproject commit b06a10407c5515a96a2905f4cfffa5894d2862dc