[Seaside] WAFileLibrary / Resource Path

Martin Kobetic mkobetic at cincom.com
Tue Aug 14 16:03:08 UTC 2007

I apologize for quoting Philippe out of context here, but we've been looking at the issue of uploading/dowloading large files via Seaside recently and my conclusion is that especially for downloading it's not really Seaside's problem to handle. It's for the associated HTTP server to worry about. To test that we can stream downloaded files directly into the socket, all I did was add a subclass of WAFileLibrary and overrode documentAt:ifAbsent: as follows:

WAExternalFileLibrary>>documentAt: aFilename ifAbsent: aBlock

	| fn |
	fn := '.' asFilename construct: aFilename.
	^fn exists
		ifTrue: [ | mimeType |
			mimeType := self mimetypeForFile: aFilename.
			WAResponse new
				contentType: (mimeType ifNil: ['application/octet-stream']);
				headerAt: 'Expires' put: 'Thu, 01 Jan 2095 12:00:00 GMT';
				stream: fn readStream;
				yourself ]
		ifFalse: [ aBlock value ]

Ignore the hardwired directory for the moment. With this I could hit  http://localhost:7777/seaside/go/files/WAExternalFileLibrary/visual.im and the 11M image file was downloaded pretty much instantly with the browser and server on the same host.

The key is that we build a WAResponse here with an external stream in it, and the rest is handled by the HTTP server. Am I missing something from the bigger picture ?



Philippe Marschall wrote:
> An other is that serving big files over Seaside is not recommended and we can't tell
> you where the limit is to the size of files Seaside can serve.
> Deployment of resources is an issue that needs to be solved at the
> Smalltalk or version control level.

More information about the Seaside mailing list