Justin Sheehy committed 1085e87

Automated commit message

  • Participants
  • Parent commits cf31546

Comments (0)

Files changed (1)


+== Webmachine URI dispatch configuration ==
+This page describes the configuration of URI dispatch to resources in a webmachine application. The dispatch map data structure is a list of 3-tuples, where each entry is of the form {pathspec, resource, args}. The first pathspec in the list that matches the URI for a request will cause the corresponding resource to be used in handling that request.
+A pathspec is a list of pathterms. A pathterm is any of [string,atom,star] where star is just the atom of "*". The pathspec-matching is done by breaking up the request URI into tokens via the "/" separator and matching those tokens against the pathterms. A string pathterm will match a token if the token is equal to that string. A non-star atom will match any single token. The star atom (* in single quotes) will match any number of tokens, but may only be present as the last pathterm in a pathspec. If all tokens are matched and all pathterms are used, then the pathspec matches.
+Any atom pathterms that were used in a match will cause a binding in the Req object passed to the resource. (if there was a foo atom that matched the token "bar", then Req:get_path_info(foo) will return "bar" inside the resource calls) If there was a star pathterm in the pathspec, then ?PATH(ReqProps) in a resource function will return the URI portion that was matched by the star.
+The resource is an atom identifying a resource that should handle a matching request. It will have the args (which must be a list) passed to its init function before request handling begins.