[Seaside] Content-Type

Brett Taylor brett.taylor at healthauditors.com
Tue Mar 8 19:25:44 CET 2005


Daniel,
I implemented a method on my subclass of WASession that allows me to easily send a file in response to a button or link click.

UserSession>>download: contents mimeType: mimeType filename: fileName
	self respond:
			[:url |
			| response |
			response := WAResponse new.
			response contentType: mimeType.
			response headerAt: 'Expires' put: 'Thu, 01 Jan 2095 12:00:00 GMT'.
			response headerAt: 'content-disposition'
				put: ('attachment ; filename=' , fileName).
			response headerAt: 'Content-length' put: contents size.
			response contents nextPutAll: contents.
			response]

!!

I use it for CSV file downloads.
Brett

On Tue, 8 Mar 2005 10:04:00 -0500, Daniel Salama <dsalama at user.net> wrote:

> Hello again,
>
> How can I specify the content-type of what I'm rendering? For example,
> I'd like to generate a PDF document on the fly and return that to the
> user or may be export a report to a CSV-like format, or if I want to
> use the javascript "command" XMLHttpRequest, it actually expects to
> receive a 100% compliant XML response.
>
> Also, on another note, more Squeak rather than Seaside related, since
> Squeak is its own VM in its own world, can I execute cron-like scripts
> within Squeak? What I'm trying to do is build some sort of a business
> application dashboard and I'd like for the system to re-compute the
> statistics every, say, 5 minutes. Sorry for posting this question here.
>
> Thanks,
> Daniel Salama
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>
>




More information about the Seaside mailing list