(no subject)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

Maarten Mostert-2
Hi,
I am trying to add a download button to my application to serve a 20MB application file.
I don't manage figure out how to make button that triggers a download dialog ?
I also wonder if MyFileLibrary is the right way to do so ?
Thanks in adavance,
@+Maarten,


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Philippe Marschall
2007/7/21, Maarten MOSTERT <[hidden email]>:
> Hi,
> I am trying to add a download button to my application to serve a 20MB application file.

The best way is to configure your webserver to serve files of this
size. Ideally something like Apache or lighty that supports streaming,
ideally sendfile. Your Squeak webserver might or might not be up to
the job.

> I don't manage figure out how to make button that triggers a download dialog ?

Buttons are not really well suited for this, anchors work way better.
What probably is the most reliable thing is:

renderContentOn: html
        html form
                with: [
                        html submitButton
                                callback: [ self session redirectTo: 'http://url.to/my.file ];
                                text: 'download' ]


> I also wonder if MyFileLibrary is the right way to do so ?

No, don't even think about it.

Cheers
Philippe

> Thanks in adavance,
> @+Maarten,
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

keith1y
In reply to this post by Maarten Mostert-2
Maarten MOSTERT wrote:
> Hi,
> I am trying to add a download button to my application to serve a 20MB application file.
> I don't manage figure out how to make button that triggers a download dialog ?
> I also wonder if MyFileLibrary is the right way to do so ?
> Thanks in adavance,
> @+Maarten,
>
>  
Hello Maarten,

some code from Gjallar for doing this

 Rendering the anchor:

                    html
                            anchor
                            callback: [attachment downloadInSession:
self session]
                            tooltip: 'Download file';
                            with: [ html html: attachment localFileName].
                       

Attachment-downloadInSession: session

    | stream |
    stream := self readStream.
    session download: stream mimeType: stream mimeType filename:
localFileName


WASession-download: contents mimeType: mimeType filename: fileName
    self respond: [:url |
        (WAResponse new)
            contentType: mimeType;
            doNotCache;
            headerAt: 'Content-Disposition' put: 'attachment;
filename="' , fileName , '"';
            headerAt: 'Content-length' put: contents size printString;
            contents: contents;
            yourself]

This download method is available as an extension to base seaside in
repository  http://www.squeaksource.com/Jetsam

cheers

Keith
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Philippe Marschall
2007/7/22, Keith Hodges <[hidden email]>:

> Maarten MOSTERT wrote:
> > Hi,
> > I am trying to add a download button to my application to serve a 20MB application file.
> > I don't manage figure out how to make button that triggers a download dialog ?
> > I also wonder if MyFileLibrary is the right way to do so ?
> > Thanks in adavance,
> > @+Maarten,
> >
> >
> Hello Maarten,
>
> some code from Gjallar for doing this
>
>  Rendering the anchor:
>
>                     html
>                             anchor
>                             callback: [attachment downloadInSession:
> self session]
>                             tooltip: 'Download file';
>                             with: [ html html: attachment localFileName].
>
>
> Attachment-downloadInSession: session
>
>     | stream |
>     stream := self readStream.
>     session download: stream mimeType: stream mimeType filename:
> localFileName
>
>
> WASession-download: contents mimeType: mimeType filename: fileName
>     self respond: [:url |
>         (WAResponse new)
>             contentType: mimeType;
>             doNotCache;
>             headerAt: 'Content-Disposition' put: 'attachment;
> filename="' , fileName , '"';
>             headerAt: 'Content-length' put: contents size printString;
>             contents: contents;
>             yourself]


Will this block the sesion until the download is finished?

Philippe

> This download method is available as an extension to base seaside in
> repository  http://www.squeaksource.com/Jetsam
>
> cheers
>
> Keith
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Maarten Mostert-2
Philippe Marschall a écrit :

> 2007/7/22, Keith Hodges <[hidden email]>:
>> Maarten MOSTERT wrote:
>> > Hi,
>> > I am trying to add a download button to my application to serve a
>> 20MB application file.
>> > I don't manage figure out how to make button that triggers a
>> download dialog ?
>> > I also wonder if MyFileLibrary is the right way to do so ?
>> > Thanks in adavance,
>> > @+Maarten,
>> >
>> >
>> Hello Maarten,
>>
>> some code from Gjallar for doing this
>>
>>  Rendering the anchor:
>>
>>                     html
>>                             anchor
>>                             callback: [attachment downloadInSession:
>> self session]
>>                             tooltip: 'Download file';
>>                             with: [ html html: attachment
>> localFileName].
>>
>>
>> Attachment-downloadInSession: session
>>
>>     | stream |
>>     stream := self readStream.
>>     session download: stream mimeType: stream mimeType filename:
>> localFileName
>>
>>
>> WASession-download: contents mimeType: mimeType filename: fileName
>>     self respond: [:url |
>>         (WAResponse new)
>>             contentType: mimeType;
>>             doNotCache;
>>             headerAt: 'Content-Disposition' put: 'attachment;
>> filename="' , fileName , '"';
>>             headerAt: 'Content-length' put: contents size printString;
>>             contents: contents;
>>             yourself]
>
>
> Will this block the sesion until the download is finished?
>
> Philippe
>
I haven't been able to get this working as I don't have the supposed
Attachement Class in my VW system.
I found a Class called AttachmentFilename though in HTTP so maybe this
is the one to use.

Maybe I can simply fork the download action in a new session ?

@+Maarten,

>> This download method is available as an extension to base seaside in
>> repository  http://www.squeaksource.com/Jetsam
>>
>> cheers
>>
>> Keith
>> _______________________________________________
>> Seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Philippe Marschall
2007/7/22, Maarten Mostert <[hidden email]>:

> Philippe Marschall a écrit :
> > 2007/7/22, Keith Hodges <[hidden email]>:
> >> Maarten MOSTERT wrote:
> >> > Hi,
> >> > I am trying to add a download button to my application to serve a
> >> 20MB application file.
> >> > I don't manage figure out how to make button that triggers a
> >> download dialog ?
> >> > I also wonder if MyFileLibrary is the right way to do so ?
> >> > Thanks in adavance,
> >> > @+Maarten,
> >> >
> >> >
> >> Hello Maarten,
> >>
> >> some code from Gjallar for doing this
> >>
> >>  Rendering the anchor:
> >>
> >>                     html
> >>                             anchor
> >>                             callback: [attachment downloadInSession:
> >> self session]
> >>                             tooltip: 'Download file';
> >>                             with: [ html html: attachment
> >> localFileName].
> >>
> >>
> >> Attachment-downloadInSession: session
> >>
> >>     | stream |
> >>     stream := self readStream.
> >>     session download: stream mimeType: stream mimeType filename:
> >> localFileName
> >>
> >>
> >> WASession-download: contents mimeType: mimeType filename: fileName
> >>     self respond: [:url |
> >>         (WAResponse new)
> >>             contentType: mimeType;
> >>             doNotCache;
> >>             headerAt: 'Content-Disposition' put: 'attachment;
> >> filename="' , fileName , '"';
> >>             headerAt: 'Content-length' put: contents size printString;
> >>             contents: contents;
> >>             yourself]
> >
> >
> > Will this block the sesion until the download is finished?
> >
> > Philippe
> >
> I haven't been able to get this working as I don't have the supposed
> Attachement Class in my VW system.
> I found a Class called AttachmentFilename though in HTTP so maybe this
> is the one to use.
>
> Maybe I can simply fork the download action in a new session ?
The best and most reliable way is:

1. Configure Apache or lighy to serve the file. As it just turned out
Swazoo is not up for the task and I wound't be surprised if Kom is not
either. Again and again we tell people to use an Apache frontend to
serve static files, exactly because of this. But no. It has to
Smalltalk, it has to block the image, it has to be copied three or
four times in the image, it has to block the session.

2. Use an achor. HTML is not really a GUI framework where a button is
simply a widget. Certain things are best done in a certain ways.
Anchors are what you need here.

html anchor
    url: 'htttp://url.to/my/file/on/apache.extension';
    with: 'Download'

Cheers
Philippe

> @+Maarten,
>
> >> This download method is available as an extension to base seaside in
> >> repository  http://www.squeaksource.com/Jetsam
> >>
> >> cheers
> >>
> >> Keith
> >> _______________________________________________
> >> Seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >>
> > _______________________________________________
> > Seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Janko Mivšek
Salut Philippe,

Philippe Marschall wrote:

> 1. Configure Apache or lighy to serve the file. As it just turned out
> Swazoo is not up for the task and I wound't be surprised if Kom is not
> either. Again and again we tell people to use an Apache frontend to
> serve static files, exactly because of this. But no. It has to
> Smalltalk, it has to block the image, it has to be copied three or
> four times in the image, it has to block the session.

Well, don't judge too fast because you could eat your words too soon :)
It seems that this can happen to you in case of Swazoo. Namely, a
problem is identified and solution is on the way. In days!

Best regards
Janko



--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (no subject)

Philippe Marschall
2007/7/22, Janko Mivšek <[hidden email]>:

> Salut Philippe,
>
> Philippe Marschall wrote:
>
> > 1. Configure Apache or lighy to serve the file. As it just turned out
> > Swazoo is not up for the task and I wound't be surprised if Kom is not
> > either. Again and again we tell people to use an Apache frontend to
> > serve static files, exactly because of this. But no. It has to
> > Smalltalk, it has to block the image, it has to be copied three or
> > four times in the image, it has to block the session.
>
> Well, don't judge too fast because you could eat your words too soon :)
> It seems that this can happen to you in case of Swazoo. Namely, a
> problem is identified and solution is on the way. In days!
I'm talking about how things are today.

Philippe

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside