Web Oriented Object Framework

User Guide (Version 0.4)

line separator

Default URL Mapping

By default, Woof! will use the following algorithm to map a URL to a controller and action.

  • Remove the URL root prefix (corresponding to the value of url_root in the configuration file) from the presented URL.
  • Remove the query and fragment components if any from the URL.
  • If the remaining fragment is empty, set it to the value of the configuration variable app_default_uri_path (which may also be empty).
  • Split the string on the / character to get a list of tokens.
  • If the list has two or more tokens, the last token is the name of the action, and the penultimate token is the name of the controller. Any preceding tokens specify the module.
  • If the list has exactly one token, it is the name of the controller. The action is the value of the configuration variable app_default_action if defined, or index otherwise. The module list is empty.
  • If the list is empty, the controller is the value of the configuration variable app_default_controller if defined or the configuration variable app_name if it is not. The action is the value of the configuration variable app_default_action if defined, or index if not. The module list is empty.

For example, if the application is rooted at /myapp, the URL /myapp/alpha/beta/gamma/delta, will be mapped to the action delta in the controller gamma in the module {alpha beta}. The controller class will be GammaController and be loaded from the file app/controllers/alpha/beta/gamma_controller.tcl in the Woof! directory.

Note this default URL mapping is used only if no custom route matches the URL as described in the next section.

Woof! Version: 0.4, Server: Apache, Interface: CGI, Tcl: 8.6b1.1