[
Table Of Contents
| Keyword Index
]
ns_register_adp(n) 4.99.2 "NaviServer Built-In Commands"
ns_register_adp - Respond to URLs with ADP or Tcl pages
TABLE OF CONTENTS
SYNOPSIS
DESCRIPTION
COMMANDS
OPTIONS
ARGUMENTS
CONFIGURATION
EXAMPLES
SEE ALSO
KEYWORDS
...
...
- ns_register_adp ?-noinherit? ?-expires t? ?-options options? ?--? method url ?file?
-
Requests to the server which match the method and url
pattern will trigger the ADP page request handler. If file is
given then it is the specific ADP page which should respond to all
matching requests. Otherwise, the ADP page will be located at request
time using ns_url2file .
- ns_register_tcl ?-noinherit? ?--? method url ?file?
-
Works the same as ns_register_adp except the file to evaluate
should be a Tcl file which uses ns_return , ns_write
etc. to respond to the request.
- ns_unregister_adp ?-noinherit? ?-recurse? ?--? method url
-
Unregister a previously registered ADP handler. The method and
url must exactly match those given to ns_register_adp .
- ns_unregister_tcl ?-noinherit? ?-recurse? ?--? method url
-
Unregister a previously registered Tcl page handler. The method
and url must exactly match those given to ns_register_tcl.
- -noinherit
-
Specifies that the directory portion of the request URL should match
exactly and not also apply to a URL lower in the hierarchy, which is
the default. Different ADP page handlers can be registered for the
same method and url if one uses the ?-noinherit?
option and the other does not.
In the previous example, a.adp will run for the requests /a, /a/b,
/a/b/c and so on. But b.adp will only run when the requested URL is
exactly /b.
In the previous example, a request for the exact URL /a will run the
x.adp page, while /a/b, /a/b/c etc. will will run the y.adp page. If
the first call to ns_register_adp was not made with the
?-noinherit? option, y.adp would also be called for the URL /a.
- -expires t
-
Specifies that the result of evaluating the ADP page should be cached
for t seconds, or until t time in the future (seconds
after 1970) if t is large.
- -options options
-
A list of one or more ADP options that should be added to the default
set which are in effect while the ADP page runs. Options can only be
enabled, not dissabled. Valid options are those that ns_adp_ctl
accepts, which can be used by ADP code to fine tune the options.
- -recurse
-
Causes the delete opperation to match the url against all
registered URLs lower in the hierarchy rather than the default which
is to perform an exact match. Use this option to delete all handlers
from a sub-hierarchy.
In the previous example, the handlers for b.adp and c.adp will be
unregistered. However, requests to /a/b/c will still be served by
a.adp as the ?-noinherit? option was not given.
- string method
-
The HTTP method, such as GET, HEAD or POST,
which will be compared using exact string equality to the HTTP request.
- string url
-
The url which will be compared against URL in each HTTP request.
- string ?file?
-
The optional ?"file"? is either the absolute path to a file in
the file system, or a path relative to the page root directory.
The first and second example specify a file relative to the page
root directory. The full path is constructed each time the ADP page is
requested using ns_pagepath , so ns_serverroot callbacks
will be taken into account.
In the third example, a specific ADP file in the server's file system
is registered for a simillarly named URL (and all URLs bellow
it). There are no calls to ns_pagepath or ns_url2file
during the request.
ADP pages can be enabled in the configuration file...
All files with the .adp extension in and below the /big URL should be
served by the ADP handler with the gzip and stream options
enabled:
| |
foreach method {GET HEAD POST} {
ns_register_adp -options {gzip stream} -- $method /big/*.adp
}
|
ns_register_fastpath, ns_register_filter, ns_register_proc, ns_register_url2file
ADP , request