Server Smalltalk Guide

Routing requests to a servlet

In this model, a request is made of a server. The server navigates a servlet graph until a servlet is found willing to handle the request. At each node, the corresponding servlet can decide to process the request and end the traversal, or forward the request to another servlet and continue the traversal. Invoker servlets are special servlets that only forward requests. An error is returned if the next servlet cannot be determined.

With HTTP, requests are to fetch the contents of a path. To aid navigating the servlet graph, the path is split into two parts: the servletPath (initially empty) and the servletPathInfo (initially set to the path). The special HTTP invoker servlets (subclasses of SstHttpInvoker) move the next component of the servletPathInfo to the servletPath and use it to identify the next servlet to try. If an invoker cannot find a matching servlet, the traversal ends in error. The navigation will otherwise end with a non-invoker servlet willing to service the request.

The servletPathInfo can be used to convey further arguments, subcategories, and the like to that servlet. Thus, for any given servlet, the servletPath is the path components that were walked to reach this servlet and servletPathInfo is the remaining components from the initial path. This maps closely to a file system: invokers act very much like a directories, and non-invokers are files.

There are some axioms for servletPath and servletPathInfo:

  1. servletPath may be empty. This can happen if the chosen servlet is the default root servlet.
  2. If servletPath is not empty, then it will begin with a /.
  3. servletPathInfo will never be empty. It will always begin with a /.

The servletPath and servletPathInfo together form the original path.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]