Difference between revisions of "Ns register trace"

From AOLserver Wiki
Jump to navigation Jump to search
Line 17: Line 17:
 
: Note ns_register_trace is similar to [[ns_register_proc]] except that the pattern-matching for the URL is performed differently. With ns_register_proc, the specified URL is used to match that URL and any URL below it in the hierarchy. Wildcards such as "*" are meaningful only for the final part of the URL, such as /scripts/*.tcl. With ns_register_trace, the URLpattern is used to match URLs as a string with standard string-matching characters. ns_register_proc results in a single match, whereas multiple ns_register_trace’s can be matched and will be called.
 
: Note ns_register_trace is similar to [[ns_register_proc]] except that the pattern-matching for the URL is performed differently. With ns_register_proc, the specified URL is used to match that URL and any URL below it in the hierarchy. Wildcards such as "*" are meaningful only for the final part of the URL, such as /scripts/*.tcl. With ns_register_trace, the URLpattern is used to match URLs as a string with standard string-matching characters. ns_register_proc results in a single match, whereas multiple ns_register_trace’s can be matched and will be called.
  
: This command differs from [[ns_register_filter]] trace in that traces registered with this command only run if the request (or a trace filter registered with ns_register_filter trace) did not result in an error. In, addition, the return value of the last trace registered with this command is ignored, hence the name ''void trace filter''.
+
: This command differs from [[ns_register_filter]] trace in that traces registered with this command only run if the request (or a trace filter registered with ns_register_filter trace) did not result in an error. In addition, the return value (including a thrown error) of any trace registered with this command is ignored, hence the name ''void trace filter''. Because the return value is ignored it is not possible for a trace registered with this command to prevent execution of the next trace or the subsequent C-level ServerTraces (i.e. access logging).
 
 
: If the registered script returns:
 
:* TCL_OK (using: return "filter_ok") - The server will continue to the next void trace filter.
 
:* TCL_BREAK (using: return "filter_break") - The rest of the void trace filters are ignored.
 
:* TCL_RETURN (using: return "filter_break") - The rest of the trace filters are ignored.  No effect on subsequent C-level ServerTrace (i.e. access logging) execution.
 
  
 
'''SEE ALSO'''
 
'''SEE ALSO'''

Revision as of 06:22, 28 October 2009

Man page: http://aolserver.com/man/4.0/tcl/ns_filter.html


NAME

ns_register_trace - Register a void trace filter for a method/URL combination

SYNOPSIS

ns_register_trace method urlPattern script ?arg?

DESCRIPTION

ns_register_trace registers a Tcl script as a trace for the specified method/URL combination. After the server handles the request for the specified method on an URL that matches the URLpattern, IF no error occurred, it calls the trace script with the connection id and any arguments (args) specified. The URLpattern can contain standard string-matching characters. For example, these are valid URLpatterns:
/employees/*.tcl /accounts/*/out 
Note ns_register_trace is similar to ns_register_proc except that the pattern-matching for the URL is performed differently. With ns_register_proc, the specified URL is used to match that URL and any URL below it in the hierarchy. Wildcards such as "*" are meaningful only for the final part of the URL, such as /scripts/*.tcl. With ns_register_trace, the URLpattern is used to match URLs as a string with standard string-matching characters. ns_register_proc results in a single match, whereas multiple ns_register_trace’s can be matched and will be called.
This command differs from ns_register_filter trace in that traces registered with this command only run if the request (or a trace filter registered with ns_register_filter trace) did not result in an error. In addition, the return value (including a thrown error) of any trace registered with this command is ignored, hence the name void trace filter. Because the return value is ignored it is not possible for a trace registered with this command to prevent execution of the next trace or the subsequent C-level ServerTraces (i.e. access logging).

SEE ALSO

ns_register_filter