Download Scriptics BizConnect

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

URL shortening wikipedia , lookup

URL redirection wikipedia , lookup

Transcript
TclHttpd
The Tcl Web Server
Brent Welch
<[email protected]>
www.scriptics.com/tclhttpd
ftp.scriptics.com/pub/tcl/httpd
Tcl/2k Conference, slide 1
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
Tcl/2k Conference, slide 2
Architecture for Extensibility
File
System
Other
Process
Your Application
Template
Doc
AppDirect
URL Dispatch
HTTP Protocol
Tcl/2k Conference, slide 3
CGI
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
Tcl/2k Conference, slide 4
Url Dispatch: Partition Hierarchy
/status
/resource
Url_PrefixInstall prefix command inThread
Url_PrefixInstall /resource ResourceDispatch 0
Tcl/2k Conference, slide 5
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
Tcl/2k Conference, slide 6
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
Tcl/2k Conference, slide 7
32 K File Fetch
Tcl/2k Conference, slide 8