7.3. Dispatcher

The WAF dispatcher connects user requests to Applications. A forum instance may live at /apps/sales/forum/ while another is at /apps/engineering/forum/. The dispatcher maps requests to the distinct Servlet and the distinct Application instance corresponding to each.

The design of the dispatcher is such that the URL-to-application mapping is reversible. Just as it is possible to navigate from a URL to a specific data partition, it is possible to navigate from a data partition back to a URL. This is done so that, given an object and its container, the WAF platform can generate an address to it through the dispatcher.

A typical path through the dispatcher takes the following steps:

  1. A request for the engineering forum at /apps/engineering/forum/index.html comes in.

  2. The dispatcher is mapped to the pattern /apps/*, so the servlet container sends the request to the dispatcher servlet.

  3. The dispatcher servlet searches the database of applications using the path, minus the /apps prefix and minus the filename suffix. The path /engineering/forum matches an Application instance and the dispatcher servlet loads it.

  4. The dispatcher servlet then fetches the path to the servlet of the application. The forum servlet is mapped to /__ccm__/servlet/forum. The dispatcher forwards the request, now in the form /__ccm__/servlet/forum/index.html.

  5. The forum servlet receives the request. It uses application ID set on the request by the dispatcher to load the data for the engineering forum. It uses the path info (in this case /index.html) part of the request to display the appropriate page in the forum UI.

  6. The engineering forum is served.

The WAF dispatcher is not responsible for serving static resources. Instead, your servlet container in its default configuration performs the work of serving images, CSS and XSL files, and JSPs. No special interaction with the dispatcher is necessary to use this feature of servlet containers.