Stef,

Thanks for Dynamic Web Development With Seaside - it's a great book!  One 
omission that I have noted is that of dynamically serving files.

Making a long story short, I have a Seaside app that swallows and regurgitates 
literature (300 MB and growing).  It is what has me interested in Citezen 
(which is working wonderfully - thanks again!).  I wish I had known more about 
Seaside when I started to write it, but it is slowly improving.  Clearly, I 
can't put hundreds of megabytes in a FileLibrary, and I have no interest in 
configuring a static web server for something that (sadly or not) runs locally 
on multiple machines, with data synchronized via what amounts to an rsynch 
clone and ever-growing flash sticks.

The answer is to serve the content dynamically, as below.  I think this 
technique deserves mention in Chapter 17.

Bill


serveFileNamed:fileName for:component canvas:html

        | mimeType |


    ( File splitExtensionFrom:fileName ) = 'pdf' ifTrue:[ mimeType := 
'application/pdf' ].
    ( File splitExtensionFrom:fileName ) = 'txt' ifTrue:[ mimeType := 
'application/text' ].
    ( File splitExtensionFrom:fileName ) = 'gz' ifTrue:[ mimeType := 
'application/x-gzip' ].

    component session requestContext respond:[ :response |
        response
            document:self fullTextAsString
            mimeType:mimeType
            fileName:fileName;
            doNotCache
    ]



Reply via email to