Subject: Re: passing code from http to TCL using AOL Server - DN [1]


aolserver-user <none@nojnnk.com> - 20 Jan 2000 - comp.lang.tcl

 Cannon Ghelani wrote:
 >
 > We are pulling our hair out with this one....any help would be appreciated.
 >
 > We are trying to get a URL to perform an action on the webserver.
 >
 > For example,  www.testing.com/username   will direct the webserver to pull
 > the index.html file in the /username directory.
 >
 > How do I get the web server to pass "username" through to a TCL module to
 > pull a dynamic page from the server.  I have 10,000 users for which I would
 > like to create "virtual web pages" for.  Is this even possible with AOL
 > Server & TCL.  Or must I use TCL Server for it's embeddable server
 > functionality?

 You'll want to "attach" a procedure to a URL space. One of two functions
 will be useful: ns_register_proc or ns_register_filter. Take a look in
 the TCL API docs (eg,
 http://www.aolserver.com/server/docs/2.3/html/tcldev.htm)
 to read about them.

 Basically, from a TCL module (not pages) you'd want to do something
 like:

   ns_register_proc GET /userpages/* servePage

 where servePage is a TCL proc that dynamically creates and sends the
 page.

 When usng ns_register_proc, you *must* create a response for the
 browser.
 If you use ns_register_filter, you have the option of letting AOLserver
 perform its default action for the URL. So with:

   ns_register_filter postauth GET /userpages/*  servePage

 The proc servePage can check a database for existence of userid or some
 such,
 and if it doesn't exist, return a code that tells AOLserver to continue
 processing
 the URL (perhaps another registered filter, or proc, but usually checks
 the filesystem). In that way, you could have a mixture of dynamic pages
 and static pages on disk in the same URL space. If that was desireable
 or needed.

 Have fun,

 Bob

Last modified
2000-02-10

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated