[Seaside] Static Content
michel.bany at gmail.com
Thu Apr 5 19:29:14 UTC 2007
You may want to implement a simple static file server that takes
advantage of the WACachedDocument class.
A subclass of WATask would do. You would need to implement
#initialRequest: to extract the file name from the url
and store it into an i-var. The #go method would look like this:
| response doc |
[doc := (WACachedDocument fileName: filename) asMIMEDocument.
response := WAResponse new.
response contents: doc content readStream.
response contentType: doc contentType.
response headerAt: 'Expires' put: 'Thu, 01 Jan 1900 12:00:00 GMT'.
response attachmentWithFileName: filename]
do: [:e | WAResponse notFound: filename].
self session returnResponse: response
On 10 Apr 2007, at 11:00 , John Thornborrow wrote:
> Good day all,
> I have been recently using Squeak and Seaside, to recreate a website
> previously powered by PHP - all is going well, I am a soon to be
> SmallTalk evangelist!
> I have stumbled upon a small hurdle, and that is Static Content (e.g.
> Images and 'attachments' such as documents/pdf's.)
> Is there a a simplified method of serving these files, without the
> for proxying via Apache or other webserver application? My Google-
> fu is
> weak today, so I have not been able to find any examples. If anyone
> could provide a link or example I would be most appreciative!
> Many thanks,
> Pinesoft Computers are registered in England, Registered number:
> 2914825. Registered office: 266-268 High Street, Waltham Cross,
> Herts, EN8 7EA
> This message has been scanned for viruses by BlackSpider
> MailControl - www.blackspider.com
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the Seaside