Static Content

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

Static Content

John Thornborrow
Good day all,

I have been recently using Squeak and Seaside, to recreate a website
previously powered by PHP - all is going well, I am a soon to be
SmallTalk evangelist!

I have stumbled upon a small hurdle, and that is Static Content (e.g.
Images and 'attachments' such as documents/pdf's.)

Is there a a simplified method of serving these files, without the need
for proxying via Apache or other webserver application? My Google-fu is
weak today, so I have not been able to find any examples. If anyone
could provide a link or example I would be most appreciative!

Many thanks,

John.
www.pinesoft.co.uk


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: Static Content

Michel Bany
You may want to implement a simple static file server that takes  
advantage of the WACachedDocument class.
A subclass of WATask would do. You would need to implement  
#initialRequest: to extract the file name from the url
and store it into an i-var. The #go method would look like this:

go
        | response doc |
        response :=
                        [doc := (WACachedDocument fileName: filename) asMIMEDocument.
                        response := WAResponse new.
                        response contents: doc content readStream.
                        response contentType: doc contentType.
                        response headerAt: 'Expires' put: 'Thu, 01 Jan 1900 12:00:00 GMT'.
                        response attachmentWithFileName: filename]
                                        on: Error
                                        do: [:e | WAResponse notFound: filename].
        self session returnResponse: response

100% Seaside.

HTH
Michel.



On 10 Apr 2007, at 11:00 , John Thornborrow wrote:

> Good day all,
>
> I have been recently using Squeak and Seaside, to recreate a website
> previously powered by PHP - all is going well, I am a soon to be
> SmallTalk evangelist!
>
> I have stumbled upon a small hurdle, and that is Static Content (e.g.
> Images and 'attachments' such as documents/pdf's.)
>
> Is there a a simplified method of serving these files, without the  
> need
> for proxying via Apache or other webserver application? My Google-
> fu is
> weak today, so I have not been able to find any examples. If anyone
> could provide a link or example I would be most appreciative!
>
> Many thanks,
>
> John.
> www.pinesoft.co.uk
>
>
> Pinesoft Computers are registered in England, Registered number:  
> 2914825. Registered office: 266-268 High Street, Waltham Cross,  
> Herts, EN8 7EA
>
>
>
> This message has been scanned for viruses by BlackSpider  
> MailControl - www.blackspider.com
>
> _______________________________________________
> 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: Static Content

Philippe Marschall
In reply to this post by John Thornborrow
Hi

If you have Seaside 2.7 and your files are not too big you can use
WAFileLibrary.

WAFileLibrary has a class comment
WAFileLibraryDemo and WAFileLibraryExample are examples

Cheers
Philippe

2007/4/10, John Thornborrow <[hidden email]>:

> Good day all,
>
> I have been recently using Squeak and Seaside, to recreate a website
> previously powered by PHP - all is going well, I am a soon to be
> SmallTalk evangelist!
>
> I have stumbled upon a small hurdle, and that is Static Content (e.g.
> Images and 'attachments' such as documents/pdf's.)
>
> Is there a a simplified method of serving these files, without the need
> for proxying via Apache or other webserver application? My Google-fu is
> weak today, so I have not been able to find any examples. If anyone
> could provide a link or example I would be most appreciative!
>
> Many thanks,
>
> John.
> www.pinesoft.co.uk
>
>
> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
>
>
> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>
> _______________________________________________
> 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: Static Content

John Thornborrow
Hi,

thanks - works great with a stream, even for large (0.5mb+) files!:

logoGif
    | stream content |
    stream _ StandardFileStream new open: '/path/to/logo.gif' forWrite:
false.
    content _ stream contents.
    stream close.
    ^contents

Philippe Marschall wrote:

> Hi
>
> If you have Seaside 2.7 and your files are not too big you can use
> WAFileLibrary.
>
> WAFileLibrary has a class comment
> WAFileLibraryDemo and WAFileLibraryExample are examples
>
> Cheers
> Philippe
>
> 2007/4/10, John Thornborrow <[hidden email]>:
>> Good day all,
>>
>> I have been recently using Squeak and Seaside, to recreate a website
>> previously powered by PHP - all is going well, I am a soon to be
>> SmallTalk evangelist!
>>
>> I have stumbled upon a small hurdle, and that is Static Content (e.g.
>> Images and 'attachments' such as documents/pdf's.)
>>
>> Is there a a simplified method of serving these files, without the need
>> for proxying via Apache or other webserver application? My Google-fu is
>> weak today, so I have not been able to find any examples. If anyone
>> could provide a link or example I would be most appreciative!
>>
>> Many thanks,
>>
>> John.
>> www.pinesoft.co.uk
>>
>>
>> Pinesoft Computers are registered in England, Registered number:
>> 2914825. Registered office: 266-268 High Street, Waltham Cross,
>> Herts, EN8 7EA
>>
>>
>>
>> This message has been scanned for viruses by BlackSpider MailControl
>> - www.blackspider.com
>>
>> _______________________________________________
>> 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