<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">> Hi there,<br>
><br>
> I know people consider serving files a job that should be handled by a<br>
> "real" http server rather than Seaside. In most cases, esp. for static<br>
> resources that can be accessed by the public, that is absolutely the case.<br>
><br>
> But I need to serve files in a callback. The files are being partly<br>
> calculated and read from a DB and should be available for download by<br>
> clicking on a link.<br>
><br>
> I've been looking into WAFileLibrary and WAFileHandler, but am not sure<br>
> where to start.<br>
><br>
> What I want to do is something like:<br>
><br>
> html anchor<br>
> callback: [self calculateChartAndServeIt]<br>
> with: 'Download full chart'.<br>
><br>
> I know I will have to respond:, but can I do that in a callback?<br>
><br>
> Joachim<br></div></div></blockquote><div><br>I do a very similar thing in my application. Generate a file and serve it up to the user. So far this has worked well:<br>downloadtext: contents named: aFilename<br> "trigger a file download operation for aFilename with the contents in contents"<br>
<br> self requestContext respond: [ : response |<br> response contentType: 'text/plain';<br> attachmentWithFileName: aFilename;<br> nextPutAll: contents.<br> ].<br><br><br>where "contents" is a string containing the text of the file to download<br>
<br></div></div>