![]() |
|||||
| What's New? | Products | Totally Objects Downloads | Other Downloads | Consultancy | VAST Training |
| Educational Discounts | See what our clients think | Buy | News Groups | Consultant's Pack | Contact Us |
aboutToGeneratePage
"Assume that the URL is of the format
fileName := ((self transaction request wsiVars at: 'QUERY_STRING' ifAbsent: ['']) subStrings: $&) first. "Strip the file name to remove any path prefix and then map this to a file in the 'webservlets' directory" filePath := CfsDirectoryDescriptor startUpDirectoryPath, 'webservlets', CfsDirectoryDescriptor pathSeparatorString, ((fileName subStrings: $/) last subStrings: $\) last. "Open the file and read the contents" fs := CfsReadFileStream open: filePath. fs isCfsError
(self subpartNamed: 'text1') string: 'No Such Script'. ^ self fs close. "Put the arg-val pairs into a dictionary" args := Dictionary new. self transaction request formDict keysAndValuesDo: [:k :v |
"Create streams to which the script can write the pages body and title" st := WriteStream with: ''. titleStream := WriteStream with: ''. ^ [
for: st "st can be refered to as 'self' in the script" arguments: (
at: 'titleStream' put: titleStream; yourself). (self subpartNamed: 'text1') string: st contents
(self subpartNamed: 'text1') string: 'Script Error'. sig exitWith: nil |
nextPutAll: (Date today printString); nextPutAll: '</b><br>'; cr. args keysAndValuesDo: [:k :v |
nextPutAll: ' = '; nextPutAll: v abtAsHtml; nextPutAll: '<br>' titleStream
|
http://127.0.0.1/cgi-bin/abtwsac.exe/WebServlet?test.txt&a=1&b=2&c=3
| The date today is 02/02/00 a = 1 b = 2 c = 3 |
|
|
| Back to Totally Objects Home Page |