[Seaside] Re: Re: [squeak-dev] [Q] File Upload/Download Server, Comanche or Swazoo

Janko Mivšek janko.mivsek at eranova.si
Wed Jul 23 20:20:40 UTC 2008


Philippe Marschall wrote:

>> Swazoo 2.x has streaming upload and download capability and can easily
>> handle such big files. I tested with few GB by myself. On both Squeak and
>> VW.
>>
>> Maybe it is a time to add that streaming to your Swazoo adaptor too? See
>> http://www.swazoo.org/streaming.html for more. See also HTTPRequestTest with
>> examples, how to use it (testing-posts).

> That assumes you already know the names of the fields containing files
> which I don't. I can only see #postDataKeys and #postKeysAndValuesDo:
> which seem to read the full request. I also couldn't find a test (or
> sender) for #postDataAt:beforeStreamingDo:.

Not knowing names of the fields is the whole point of "deferring" 
parsing the POST request until this information is known. Deferring 
means that request is not read and completely parsed already by Swazoo 
but lately, when some post data is first needed. That allows you to 
delay streaming too, until you have enough info where to stream and to 
open the destination file accordingly.

See this example from http://www.swazoo.org/streaming.html:

Site>>answerTo: aHTTPRequest
   | stream |
   aHTTPRequest
     postDataAt: 'file'
     beforeStreamingDo: [:datum |
       stream := (SpFilename named: datum filename) writeStream.
       datum writeStream: stream].

   aHTTPRequest ensureFullRead. "to be sure streaming occurs"
   stream close.           "mandatory, to close open stream! "

   ^HTTPResponse ok


In that example we open a file named as the original file, which  is 
sent in request as post data, just before a file content.

I hope that helps

Best regards
Janko


-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si


More information about the seaside mailing list