[Seaside] Static Content

Michel Bany 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 |
	response :=
			[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]
					on: Error
					do: [:e | WAResponse notFound: filename].
	self session returnResponse: response

100% Seaside.


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  
> need
> 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,
> John.
> www.pinesoft.co.uk
> 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
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the Seaside mailing list