[Seaside] Serving non-html dynamically
Sven Van Caekenberghe
sven at beta9.be
Fri Jul 2 21:00:47 UTC 2010
James, Julian,
Thanks a lot: this works like a charm!
I just tested with this example:
servePdf
self requestContext respond: [ :response |
response
document: self getPdfBytes mimeType: 'application/pdf' fileName: 'seaside-test.pdf';
doNotCache ]
I was indeed working in Seaside 3.0.
It keeps on amazing me how deep Seaside really is !
Have a nice weekend.
Sven
On 02 Jul 2010, at 20:20, Julian Fitzell wrote:
> Note that's 2.8. In 3.0 you would call "self requestContext response"
> to get a response object and then use instance-side methods to set it
> up as you want. Or
>
> self requestContext respond: [ :response | "set up your response here" ]
>
> You might also like to create a RequestHandler subclass if you are
> doing a lot of this and the URLs are more "REST-like" (rather than
> doing this in a component).
>
> Julian
>
> On Fri, Jul 2, 2010 at 5:24 PM, James Foster <Smalltalk at jgfoster.net> wrote:
>> Hi Sven,
>>
>> I have occasion to return dynamically generated documents that open in Excel. The following gives the general approach (where 'self returnCSV' is in an anchor callback block):
>>
>>
>> MyWAComponent>>#'returnCSV'
>>
>> | response |
>> response := WAResponse
>> document: self asCSV
>> mimeType: (WAFileLibrary mimetypeFor: 'csv')
>> fileName: self caption , ' (' , DateAndTime now printString , ').csv'.
>> response doNotCache.
>> self session returnResponse: response.
>>
>> James
>>
>>
>> On Jul 2, 2010, at 1:24 AM, Sven Van Caekenberghe wrote:
>>
>>> Hi,
>>>
>>> Does anybody know or can point me to a simple/elegant solution to serving non text/html content dynamically using Seaside ?
>>>
>>> Say you have a Seaside app that generates dynamic reports in formats like PDF or XLS, how to you generate such an answers ? Serving dynamically generated images like graphs would be another use case.
>>>
>>> TIA,
>>>
>>> Sven
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
More information about the seaside
mailing list