Rewrite responder overview
URL rewrite responders

Next:rewrite


Rewrite responders take the file name and turn it into a request parameter named by the param slot before delegating to a child responder. If a file name is provided, it calls the responder in the child slot. If no file name is provided, they call the default responder in the default slot.

For example, suppose you want to have the following website schema:
/posts/ - show a list of posts
/posts/factor_language - show thread with ID factor_language
/posts/factor_language/1 - show first comment in the thread with ID factor_language
/animals, ... - a bunch of other actions

One way to achieve this would be to have a nesting of responders as follows:
A dispatcher at the top level
A rewrite as a child of the dispatcher under the name posts. The rewrite has the param slot set to, say, post_id. The default slot is set to a Furnace action which displays a list of posts.
The child slot is set to a second rewrite instance, with param set to comment_id, the default slot set to an action which displays a post identified by the post_id parameter, and the child slot set to an action which displays the comment identified by the comment_id parameter.

Note that parameters can be extracted from the request using the param word, but most of the time you want to use furnace.actions instead.