About Wub: Domains/Direct

(Parent)

A domain which dispatches URL requests to commands within a namespace or methods within an object. Note that only commands whose name starts with '/' will be exported to the web.

QuickStart

Create a namespace NS containing commands of the form [proc /name {r arg1 arg2 ...} {}]

[Nub domain /prefix/ Direct namespace NS]

Now any URL reference to /prefix/FRED will invoke the command ::NS::/FRED with any URL query args passed as actual parameters.

Operation

A target URL is interpreted as a command/method invocation with its query arguments interpreted as actual parameters.

Argument defaults are honoured, as is the $args formal parameter - unspecified query arguments are passed into the target command as a dict. Multiple query args with the same name are passed as a list of values.

Prefix invocation is supported, where a url like /fred/wilma will be matched by command /fred if /fred/wilma is not found. The unmatched url suffix can be found in [dict $r get -extra]

Wildcard invocation is supported, with unmatched urls being handled by a nominated default command.

TODO

Different varieties of command might be supported. Specifically, interps should be considered as a valid command container.

Homage

This concept is an extension of TclHttpd's domain of the same name.

Constructor Options

namespace
namespace in which to invoke commands
object
object in which to invoke commands
ctype
default content-type of returned values
wildcard
process to be used if a request doesn't match any proc in $namespace (default /)
correct
insist that the top level domain is referenced with a trailing / (default: yes)
package
load named package when constructing this object

(generated by STX)