Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tcl/2k Conference, slide 1 TclHttpd The Tcl Web Server Brent Welch ftp.scriptics.com/pub/tcl/httpd.

Similar presentations


Presentation on theme: "Tcl/2k Conference, slide 1 TclHttpd The Tcl Web Server Brent Welch ftp.scriptics.com/pub/tcl/httpd."— Presentation transcript:

1 Tcl/2k Conference, slide 1 TclHttpd The Tcl Web Server Brent Welch www.scriptics.com/tclhttpd ftp.scriptics.com/pub/tcl/httpd

2 Tcl/2k Conference, slide 2 Goals and Experiences Embeddable, Extensible Web Server –Add web interface to your application –License server, DHCP server, Mail List Server General Purpose Web Server –Page Templates –Built-in form handlers –sunscript.sun.com –www.scriptics.com

3 Tcl/2k Conference, slide 3 Architecture for Extensibility HTTP Protocol URL Dispatch App- Direct CGI Doc Template Your Application File System Other Process

4 Tcl/2k Conference, slide 4 Architecture for Extensibility URL Dispatch –Implement a URL sub-tree, interpret meaning of URL path Application-Direct –Maps a URL to a Tcl Procedure. Maps form data to procedure arguments. Document Templates –Procedure calls, variable references inside HTML pages General Doc-Type handlers Authentication hook

5 Tcl/2k Conference, slide 5 Url Dispatch: Partition Hierarchy Url_PrefixInstall prefix command inThread Url_PrefixInstall /resource ResourceDispatch 0 /resource/status

6 Tcl/2k Conference, slide 6 Application-Direct Map URL to Tcl Procedure Direct_Url /status Status proc Status/doc { {pattern *} {sort hits} } { # Display URLs matching $pattern # Sort display by name or hit count return $html } /status/doc?pattern=/images*&sort=name Missing parameters get default value, or “” Return value of proc is the page Set alternate content-types, not just text/html

7 Tcl/2k Conference, slide 7 Document Templates: HTML+Tcl Use Tcl to general complex HTML for navigation Put simple calls into pages [scriptics::header “Title” lev1 lev2 lev3] Cache template output in plain.html file Form handlers –Embed calls to handle incoming form data –“Self-posting forms” repopulate fields, then redirect to the next page when everything is OK

8 Tcl/2k Conference, slide 8 32 K File Fetch


Download ppt "Tcl/2k Conference, slide 1 TclHttpd The Tcl Web Server Brent Welch ftp.scriptics.com/pub/tcl/httpd."

Similar presentations


Ads by Google