The controller configuration that contains the routing rules is loaded from the controller.xml
file retrieved in the GateIn configuration directory. Its location is determined by the gatein.controller.config
property.
WebAppController loads and initializes the mapping engine.
<!-- conf/portal/controller-configuration.xml of portal.war -->
<component>
<type>org.exoplatform.web.WebAppController</type>
<init-params>
<value-param>
<name>controller.config</name>
<value>${gatein.portal.controller.config}</value>
</value-param>
</init-params>
</component>
GateIn's extension project can define their own routing table, thanks to the extension mechanism.
The controller.xml
file can be changed and reloaded at runtime. This helps the test of different configurations easily (configuration loading operations) and provides more insight into the routing engine (the findRoutes operation). See Rebuiding controller below for more details.
ReBuilding controller
The WebAppController is annotated with @Managed
annotations and is bound under the view=portal,service=controller
JMX name and under the "portalcontroller" REST name.
It provides the following attributes and operations:
Attribute configurationPath: The "read-only" configuration path of the controller.xml
file.
Operation loadConfiguration: Loads a new configuration file from a specified XML path.
Operation reloadConfiguration: Reloads the configuration file.
Operation findRoutes: Routes the request argument through the controller and returns a list of all parameter map resolutions. The argument is a request URI, such as /g/:platform:administrators/administration/registry
. It returns a string representation (List<Map>
) of the matched routes.