New Message: Re: Returning data rather than html
webmaster at userland.com
webmaster at userland.com
Wed Jun 29 09:59:34 CDT 2005
A new message was posted:
Address: http://frontier.userland.com/discuss/msgReader$14138
By: Samuel Reynolds (sam at spinwardstars.com)
Here's the key block from a reporting framework I did recently for a client. It shows the elements that need to be set in the page table.
pageTbl^.responseBody = EvenStartSuite.reports.generateReport( reportName, postArgsAdr, requestedFmt );
pageTbl^.responseHeaders.["Content-Disposition"] = "attachment; filename=" + GenFilename( now );
pageTbl^.responseHeaders.["Content-Type"] = "text/" + requestedFmt;
pageTbl^.responseHeaders.["Last-Modified"] = date.netStandardString( now );
EvenStartSuite.utils.DisallowHTTPCaching( pageTbl );
«Short-circuit all remaining processing and just return the content.
scriptError( "!return" )
In this application, /requestedFmt/ may be "xml", "html", or "csv".
You may or may not want to turn off HTTP caching. If so,
DisallowHTTPCaching looks like this:
on DisallowHTTPCaching( pageTbl=nil ) {
if pageTbl == nil {
pageTbl = html.getPageTableAddress()};
pageTbl^.responseHeaders.Pragma = "no-cache";
pageTbl^.responseHeaders.["Cache-Control"] = "no-cache"}
HTH.
- Sam
This is a Manila site.. http://manila.userland.com/.
More information about the Manila-Server
mailing list