ns_urlspace - Assign Application Data to URLs.
The command ns_urlspace allows one to assign/query/list/delete data to the trie representing the URL space. The command supports filters and inheritance such one can e.g. assign data to certain patterns of pages (e.g. to .adp-pages) or such one can assign data to a higher level node which can be inherited to all nodes below this one.
The values assigned to the URL space are shared among all threads of a server. So this command is somewhat similar to the set of nsv commands, but differs in its inheritance and filtering capabilities.
The command allows e.g. to implement access control (like the nsperm module) on the Tcl level. Other applications are e.g. blacklisting of certain parts of the URL tree from statistics, or to assign different master templates to different parts of the URL tree.
Assign a value to a node in the URL space. Per default, the value is inherited to all sub-nodes, unless the option -noinherit is specified.
Retrieve a value from the URL space for a specified URL. Per default, the returned values might be inherited from a parent node. When the option -exact is used, the inheritance is deactivated, and only the values are returned directly assigned to the URL. When the option -noinherit is specified, only values set with the -noinherit flag are returned.
List the values assigned to the URL space. The command returns a list of lists, containing for every item the 5 elements
key
path
filter pattern
the constants inherit or noinherit
the assigned data
Unset a value for a URL for the given or default key. This command undoes the effects of ns_urlspace set. When the options -noinherit is used the values set this way are deleted and vice versa. The option -recurse performs the operation recursively. Unless -recurse is specified, the command returns 1 or 0 on success or failure.
Allocate a new URL space id. When the number of compile-time configured URL spaces runs out, a Tcl exception is raised.