Configuration elements
Like all Calyxo components, the controller is configured by one or more XML configuration files. The most essential elements are
-
action elements: an action element defines how
to handle a request for some module-relative path. An
action may specify an action class to be invoked.
For example,
<action path="/show" class="...ShowAction">...</action>
will invoke ...ShowAction, when the module selects action /show. -
dispatch elements: a dispatch element defines
a branch of control under some name. You can branch to
another action or an application resource.
For example,
<dispatch name="foo" module="clients" action="/show"> ... </dispatch>
defines, that dispatching to foo will result in executing action /show in module clients. The module attribute is optional and needed only for module switches. On the other hand,<dispatch name="bar" path="/WEB-INF/jsp/show.jspx"> ... </dispatch>
defines, that dispatching to bar will result in displaying JSP page /WEB-INF/jsp/show.jspx. Dispatch elements may appear inside action elements or as global dispatches, visible to all actions. -
filter elements: actually, an action is embedded into a
chain of action filters. Filters may intercept before and after the
action has been executed. Typical candidates for filters are:
cancelled forms, input validation, role based security, ...
As an example,
<filter name="foo">...</filter>
inside an action element will add the foo filter to the action filter chain. -
param elements: all elements mentioned so far may be
parametrized with param elements. A parameter simply has a
name and a string value. For example,
<param name="foo" value="bar"/>
inside an action, dispatch or filter element adds a parameter with name "foo" and value "bar" to the the configuration element. Dispatch parameters are added as parameters to the forwarded request.
The controller configuration also provides other elements, that we won't cover here. For example, you may define exception handlers and plugin extensions.


