# Example: CGI-style Request Procedures

- ## ns_register_proc binds procs to arbitrary requests:

ns_register_proc GET /demo/time getTime

proc getTime {} {

set headers [ns_conn headers]

set browser [ns_set iget $headers User-Agent]

set page “<html><body>\n”

append page “Time: [clock seconds]<br>\n”

append page “Browser: $browser\n”

append page “</body></html>”

ns_return 200 text/html $page

}

Previous slide | Next slide | Back to first slide | View graphic version