(index ("dispatch-uri" 0) ("whitelist" 1627) ("dispatch-error" 1777) ("default-dispatch-target" 2107) ("dispatch-environment" 2335))
(def (sig (procedure "(dispatch-uri URI)" (id dispatch-uri))) (p "The main interface to dispatch-uri. This procedure invokes the dispatch-mechanism with the supplied uri. The dispatch-algorithm is implemented as follows:") (p "(" (b "Note") " See also the whitelisting-section, to learn how to limit the exposure of procdures)") (ul (li "The path is empty. It checks if " (b "default-dispatch-target") " is bound to a procedure. If it is, then it is invoked. If it is not, then " (b "dispatch-error") " is invoked.") (li "The path has exactly one element. It assumes that this element is the name of a thunk that was defined outside a module. If such a thunk exists it is invoked. If no such a thunk exists " (b "dispatch-error") ".is invoked.") (li "The path contains at least two elements. " (ul (li "It checks if the second element is a procedure defined in a module named by the first element. So if it sees (foo bar) it tries to find the procedure bar inside the module foo. If the procedure exists it is invoked with the rest of the elements as arguments.") (li "If it does not exist, it interpretes the first element as the name of a procedure that was defined outside any module. If such a procedure exists, it is invoked passing the rest of the elements as arguments. If no such procedure exists " (b "dispatch-error") " is invoked with the full path as arguments. The path is applied to the procedure so you can use for example dsssl-style lambda-lists to declare optional arguments or a rest-argument.")))) (p "All those lookups are done in the current " (b "dispatch-environment") ", which can be parameterized."))
(def (sig (parameter "whitelist" (id whitelist))) (p "The parameter holding the whitelist. It defaults to #f which means whitelisting is disabled."))
(def (sig (parameter "dispatch-error" (id dispatch-error))) (p "If no handler for a uri can be found, the dispatcher will invoke the procedure that dispatch-error is currently parameterized with. " (b "NOTE") " dispatch-error is also invoked if the requested handler exists but is not whitelisted. Defaults to (constantly #f)."))
(def (sig (parameter "default-dispatch-target" (id default-dispatch-target))) (p "A thunk that is invoke when the uri-path was empty. If set to #f then an empty path leads to the invocation of dispatch-error. Defaults to #f."))
(def (sig (parameter "dispatch-environment" (id dispatch-environment))) (p "The environment that is used to lookup the procedures. It defaults to " (b "interaction-environment") "."))
