[Seaside] download and continue

Julian Fitzell jfitzell at gmail.com
Wed Jul 27 09:16:28 UTC 2011


Both #document:mimeType:fileName: and #callback: set the href
attribute of the anchor, so one will override, the other.

As I responded to the earlier thread about this question, there are
ways of removing the called component prior to responding with the
document, but HTTP only allows for a single response per request.
Either you return an HTML page or you return a document; you can't
return both. To work around that you'd have to play tricks with
automatic refresh, iframes, javascript or the like.

Julian

On Wed, Jul 27, 2011 at 9:59 AM, Carlo <snoobabk at yahoo.ie> wrote:
>
> My Seaside is rusty but why can't you try:
>
>                html anchor
>                        document: file contents
>                                mimeType: file contentType
>                                fileName: file fileName ;
>                        callback: [self answer: true];
>                        text: file fileName.
>
> where file is a WAFile object e.g.
>         WAFile new
>                contents: multiStream contents ;
>                fileName: self action , '_RESPONSE.zip' ;
>                contentType: 'application/zip'
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 26 Jul 2011 11:15:23 -0700
> From: Jon Paynter <kittle31 at gmail.com>
> Subject: [Seaside] download and continue
> To: seaside at lists.squeakfoundation.org
> Message-ID:
>        <CAPoFHR4fndifRuHBg1a4u4vGN1Yuyjj6vGdru1-Xa39GZYt3WA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Im trying to setup my application to provide a download link to a generated
> file, and then continue with the application flow after the user clicks the
> download link.  My application generates a script file, then provides a
> download link.  When the user clicks on the download link, it has to record
> that the download happened, and then exit the script generation component.
>
> I have the following method:
>
> downloadScript
>   self markAsApplied.
>   self requestContext respond: [ : response |
>       response contentType: 'text/plain';
>       attachmentWithFileName: 'EMS.conf';
>       nextPutAll: self generatedScript.
>   ].
>
> Which marks as applied, and causes the browser to download the file. But I
> afterwards I need to call: "self answer: true"  so the component will exit.
> just adding: "self answer: true" at the end of the method doesnt work.
>
> I found WARequestContext>>respondAndContinue:  but that did not work -- the
> block argument is a url instead of the response object
>
> How do I resume processing after doing a download?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110726/67b44e54/attachment-0001.htm
>
> ------------------------------
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the seaside mailing list