Dispatchers implement the de.odysseus.calyxo.control.Dispatcher interface, which defines the single method

public void dispatch(
  HttpServletRequest request,
  HttpServletResponse response,
  DispatchConfig config) throws IOException, ServletException;

The de.odysseus.calyxo.control.conf.DispatchConfig interface reflects a dispatch configuration and provides methods to access the dispatch path, module and action, the redirection flag as well as the dispatch parameters.

A custom dispatcher has to be registered by a plugin using either method of de.odysseus.calyxo.control.PluginContext:

Custom dispatchers may be referenced by name in <action> and <dispatch> configurations through their dispatcher attribute.

An action invocation results in a dispatch configuration. The module selects a dispatcher as follows: if the dispatch configuration has a dispatcher set, use it; otherwise, if the action configuration has a dispatcher set, use it; otherwise, use the default dispatcher. In other words, the dispatch's dispatcher is most significant, followed by the action's dispatcher, followed by the default dispatcher.

If not overridden, Calyco Control uses de.odysseus.calyxo.control.impl.DefaultDispatcher as the default dispatcher. This dispatcher processes a dispatch configuration as follows:

  1. if the dispatch configuration specifies an action (and a module),
    path := context-relative path of that action (in that module)
  2. if the dispatch configuration specifies a path,
    path := that path
  3. append the dispatch parameters to path as HTTP query parameters
  4. if the redirection flag is set and path starts with '/',
    prepend the context path to path
  5. dispach using redirect, forward or include:
    • if the redirection flag is set, redirect the response to path
    • otherwise, if the response is not yet committed, forward to path
    • otherwise, include path

Custom dispatchers are free to reuse the default dispatcher by subclassing it or delegating to it.