Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.webserver.data.trapScript
on sdoc (pathArgs, kfor="", user="", pass="", frmu="", addr="", svpt="", svnm="", scnm="", meth="", refr="", Kcid="", Kact="", Kapt="", ctyp="", post="", Kcip="", Kfrq="", Agnt="", DIRE="") { local (paramtable, appID, appName, websiteFolderPath, serverPath); new (tableType, @paramtable); <<The binaryID should be used in send-partial commands <<in place of the appID or appName. The binaryID specifies <<the application that sent the CGI sdoc event <<specifically. This way you can have two copies of WebSTAR <<(for instance) running at the same time. <<Example: <<webstar.sendpartial (myData, adrparams^.connectionID, true, adrparams^.binaryID) <<[Technically: the binaryID is always either a ProcessSerialNumber or a Target ID Record <<('psn ' or 'targ'), but you don't need to know that to use it.] local (binaryID = getEventSender ()); <<Get info about the server app. bundle { <<Get the website folder path. if DIRE != "" { <<DIRE is the website folder parameter websiteFolderPath = DIRE} else { websiteFolderPath = webserver.getPref ("websiteFolderPath")}; <<Get the server app path and name serverPath = webserver.getPref ("serverPath"); try { appName = file.fileFromPath (serverPath)}; <<Get the server appID try { appID = file.creator (serverPath)}}; bundle { <<Set up CGI params table paramtable.action = Kact; paramtable.actionPath = Kapt; paramtable.appID = appID; paramtable.appName = appName; paramtable.binaryID = binaryID; paramtable.clientAddress = addr; paramtable.clientIP = Kcip; paramtable.connectionID = Kcid; paramtable.contentType = ctyp; paramtable.fromUser = frmu; paramtable.fullRequest = Kfrq; paramtable.httpSearchArgs = kfor; paramtable.method = meth; paramtable.password = pass; paramtable.pathArgs = pathArgs; paramtable.postargs = post; paramtable.referer = refr; paramtable.scriptName = scnm; paramtable.serverName = svnm; paramtable.serverPath = serverPath; paramtable.serverPort = svpt; paramtable.userAgent = Agnt; paramtable.username = user; paramtable.websiteFolder = websiteFolderPath; <<Parse the post args, if they exist. if paramtable.postargs != "" { new (tabletype, @paramtable.argtable); webserver.parseArgs (post, @paramtable.argtable)}}; return (webserver.handler (@paramtable))}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.