32 Chapter 6. WAF Component: Web
• Request context — The BaseServletpackages certain facts about the request, such as the current
user, current application, etc., and loads them into a context object whose data is available to any
code running inside the servlet.
The BaseServlet is used in two principal ways in WAF:
• New applications will sometimes use custom servlets that extend the BaseServlet and use the
Servlet API to implement their UI.
• Applications that use JSPs can take advantage of the WAF platform by having their JSP pages
extend the BaseJSP class. Any code inside of the JSP will then be able to use the transaction and
request context setup by the BaseServlet.
6.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.htmlcomes 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 thedatabase of applications using the path,minus the /appsprefix
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.