[commits] [Wiki] changed: Doc/Dev/Horde_Controller

Ralf Lang (B1 Systems GmbH) lang at b1-systems.de
Wed Oct 10 21:44:59 UTC 2018


rlang  Wed, 10 Oct 2018 21:44:59 +0000

Modified page: https://wiki.horde.org/Doc/Dev/Horde_Controller
New Revision:  3
Change log:  add flow of control in general and specifically for horde apps

@@ -5,9 +5,40 @@
  Documentation on using Horde_Controller

  ++ General Info

-++ Horde_Controllers in Horde Core Apps
+++ General flow of processing
+
+A request object (Interface Horde_Request) is generated from server  
variables.
+Some helper generates a Horde_Controller_RequestConfiguration  
instance (a config). The config defines which controller to execute  
and which SettingsExporter to use. The SettingsExporter affects which  
pre and post filters are run by the FilterRunner, among other things.
+The request and the config are fed into a runner. The runner will  
return a response object. The runner may first execute prefilters on  
the request. Depending on the prefilter outcome, the originally  
defined controller may not be executed at all.
+After the controller is run, post filters may change the response  
(for example, tidying output, applying compression)
+
+++ Horde App specific flow of processing
+
+Web Server configuration redirects any unmatched URLs to horde/rampage.php
+
+rampage.php sets up a horde environment with auth and the horde base app
+
+Get a Horde_Controller_Request_Http request object from running  
Horde_Core_Factory_Request
+Get a Horde_Controller_Runner instance
+Get a Horde_Core_Controller_RequestConfiguration from  
Horde_Core_Controller_RequestMapper::getRequestConfiguration
+The first path component after the horde base app's webroot will be  
interpreted as the app name.
+The remaining parts of the request uri are interpreted relative to  
the identified app's web root.
+The requestMapper in turn will get a list of routes to match from app  
fileroot/config/routes.php
+If no defined route matches, a default Horde_Core_Controller_NotFound  
is returned
+
+Otherwise, a controller class name is found and the identified app's  
context is loaded ($registry->pushApp())
+The controller class found is added to the RequestConfiguration.
+The SettingsFinder looks for an $app_$controller_SettingsExporter  
class, otherwise it adds the Horde_Controller_SettingsExporter_Default  
to the config - which exports no filters or bindings to the runner
+
+
+Let the runner create a $response = $runner->execute($injector,  
$request, $config);
+
+
+Finally, get a responseWriter (_Web is the default) and render the  
response object to the output
+
+++ How to use Horde_Controllers in Horde Core Apps

  Horde Controllers are independent from the Horde Ajax Framework.  
Controllers need Horde_Routes and need rewrite rules.

  Ajax application controllers do not live in {{lib/}} but in  
{{$app/app/controllers/}}



More information about the commits mailing list