Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

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

Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

aditya siram-2
I am trying to incorporate images into my website.

However I would rather not use the methods listed in the "Resources" section of  the Seaside Tutorial at http://www.swa.hpi.uni-potsdam.de/seaside/tutorial. The CSS method reloads the image everytime,  and the WAFileLibrary method inflates the Seaside image terribly. Using Apache as a proxy is not desirable because I am using Seaside mainly for its portability ie. I can stick the entire Seaside image on a flash drive and move the web-server from PC to PC with minimal hassle compared to other frameworks.

Is there some way to have the Seaside read the images  off some directory on the file system?

Deech



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

Re: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

Holger Kleinsorgen-3
aditya siram schrieb:
> I am trying to incorporate images into my website.
>
> Is there some way to have the Seaside read the images  off some directory on
> the file system?

have a look at WAExternalFileLibrary

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

Re: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

aditya siram-2
I don't appear to have that class in my image. I am using the current Seaside-One-Click-Experience. Is this an extension?

Deech

On Wed, Apr 23, 2008 at 7:51 AM, Holger Kleinsorgen <[hidden email]> wrote:
aditya siram schrieb:
I am trying to incorporate images into my website.

Is there some way to have the Seaside read the images  off some directory on
the file system?

have a look at WAExternalFileLibrary

_______________________________________________
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: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

Holger Kleinsorgen-3
aditya siram schrieb:
> I don't appear to have that class in my image. I am using the current
> Seaside-One-Click-Experience. Is this an extension?

ah, I didn't notice this before, it's an extension in VisualWorks /
Seaisde-OpenTalk.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

mkobetic-2
The extension is rather trivial as you can see in the attached file-out. It should file into Squeak fine, although there
might be some VW specific bits in it, so you may have to fix it up for it to actually work in Squeak. One not so trivial
issue is that we're building the WAResponse with an external stream in it as the body. Seaside-Opentalk will actually
stream the contents of the file straight into the socket, which is important if you plan to serve larger files. I don't
know how to make the Squeak servers do that efficiently as well. The usual problem is that the entire file is read into
memory first and only then sent out, which obviously could cause significant memory overhead and stress the garbage
collector.

HTH,

Martin

Holger Kleinsorgen wrote:

> aditya siram schrieb:
>> I don't appear to have that class in my image. I am using the current
>> Seaside-One-Click-Experience. Is this an extension?
>
> ah, I didn't notice this before, it's an extension in VisualWorks /
> Seaisde-OpenTalk.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

'From VisualWorks®, 7.6 of March 3, 2008 on April 23, 2008 at 11:00:47 am'!


WAFileLibrary subclass: #WAExternalFileLibrary
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'SeasideForOpentalk'!

WAExternalFileLibrary class
        instanceVariableNames: ''!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!


!WAExternalFileLibrary class methodsFor: 'testing' stamp: ' 23/4/08 11:00'!

handlesFolder: aSymbol
       
        ^aSymbol = #external! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!


WAExternalFileLibrary comment:
'This class adds the ability to serve content from files external to the image.

The files go in to a subdirectory from the running directory called ''files''
The URL to access the files is: http://localhost:7777/seaside/files/external/myfile.png

Seaside protects against malicious users attempting to use ''..'' to access above the ''files'' directory.'!

!WAExternalFileLibrary methodsFor: 'accessing' stamp: ' 23/4/08 11:00'!

documentAt: aFilename ifAbsent: aBlock
       
        | fn files |
        files _ 'files' asFilename.
        (files exists and: [files isDirectory]) ifFalse: [^aBlock value].
        fn _ files construct: aFilename.
        ^fn exists
                ifTrue:
                        [| mimeType |
                        mimeType _ self mimetypeForFile: aFilename.
                        (WAResponse new)
                                contentType: (mimeType ifNil: ['application/octet-stream']);
                                headerAt: 'Expires' put: 'Thu, 01 Jan 2095 12:00:00 GMT';
                                stream: fn readStream binary;
                                yourself]
                ifFalse: [aBlock value]!

urlOf: aSymbol using: aHandler
       
        ^(aHandler baseUrl)
                addToPath: 'external';
                addToPath: (self asFilename: aSymbol);
                yourself! !

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

Re: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

Miguel Enrique Cobá Martínez
In reply to this post by aditya siram-2
I think you should mantain all your assets outside the smalltalk image. Seaside it is very good with web apps, but it isn't very good at serving static content. The right tool for the right task. I use lighttpd on debian to serve all the images (*.jpg, *.gif), css (*.css), javascripts (*.js) for my app. It has a very small memory footprint, you can use it as a reverse proxy/load balancer to scale up your app (with several images running as workers  behind lighttpd, and user mod_proxy to serve the static content by itself and only delegating to seaside what it is your web app.
My advice is: do not try to have all the things inside the image. It is going to revert back when you try to scale it (think of updating an jpg in your production app with a lot of smalltalk images working in parallel. A lot of pain)

Miguel Cobá

On Wed, Apr 23, 2008 at 7:46 AM, aditya siram <[hidden email]> wrote:
I am trying to incorporate images into my website.

However I would rather not use the methods listed in the "Resources" section of  the Seaside Tutorial at http://www.swa.hpi.uni-potsdam.de/seaside/tutorial. The CSS method reloads the image everytime,  and the WAFileLibrary method inflates the Seaside image terribly. Using Apache as a proxy is not desirable because I am using Seaside mainly for its portability ie. I can stick the entire Seaside image on a flash drive and move the web-server from PC to PC with minimal hassle compared to other frameworks.

Is there some way to have the Seaside read the images  off some directory on the file system?

Deech



_______________________________________________
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: Integrating Images on a website. Don't want to useApache or WAFileLibrary.

Boris Popov, DeepCove Labs (SNN)
I like having all resources version-controlled together with the code that uses them. You can then lazily cache them on the front-end server to avoid hitting the Seaside service if you wish, just make sure the URLs have version identifier in them if you intend of running multiple versions of the application at the same time on the same domain.

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: [hidden email] [mailto:seaside-
> [hidden email]] On Behalf Of Miguel Cobá
> Sent: Wednesday, April 23, 2008 9:37 AM
> To: Seaside - general discussion
> Subject: Re: [Seaside] Integrating Images on a website. Don't want to
> useApache or WAFileLibrary.
>
> I think you should mantain all your assets outside the smalltalk image.
> Seaside it is very good with web apps, but it isn't very good at serving
> static content. The right tool for the right task. I use lighttpd on
> debian to serve all the images (*.jpg, *.gif), css (*.css), javascripts
> (*.js) for my app. It has a very small memory footprint, you can use it as
> a reverse proxy/load balancer to scale up your app (with several images
> running as workers  behind lighttpd, and user mod_proxy to serve the
> static content by itself and only delegating to seaside what it is your
> web app.
> My advice is: do not try to have all the things inside the image. It is
> going to revert back when you try to scale it (think of updating an jpg in
> your production app with a lot of smalltalk images working in parallel. A
> lot of pain)
>
> Miguel Cobá
>
>
> On Wed, Apr 23, 2008 at 7:46 AM, aditya siram <[hidden email]>
> wrote:
>
>
> I am trying to incorporate images into my website.
>
> However I would rather not use the methods listed in the "Resources"
> section of  the Seaside Tutorial at http://www.swa.hpi.uni-
> potsdam.de/seaside/tutorial. The CSS method reloads the image everytime,
> and the WAFileLibrary method inflates the Seaside image terribly. Using
> Apache as a proxy is not desirable because I am using Seaside mainly for
> its portability ie. I can stick the entire Seaside image on a flash drive
> and move the web-server from PC to PC with minimal hassle compared to
> other frameworks.
>
> Is there some way to have the Seaside read the images  off some
> directory on the file system?
>
> Deech
>
>
>
> _______________________________________________
> 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: Integrating Images on a website. Don't want to useApache or WAFileLibrary.

aditya siram-2
Thank you all for your help!
I have decided to launch an HttpService on another port that allows access to the directory with all my image files. I have the second server running but I haven't tested it yet. Since the 'Seaside Tutorial' outlines much the same concept using Apache I am optimistic that it will work.

Deech

On Wed, Apr 23, 2008 at 11:41 AM, Boris Popov <[hidden email]> wrote:
I like having all resources version-controlled together with the code that uses them. You can then lazily cache them on the front-end server to avoid hitting the Seaside service if you wish, just make sure the URLs have version identifier in them if you intend of running multiple versions of the application at the same time on the same domain.

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]
> [hidden email]] On Behalf Of Miguel Cobá
> Sent: Wednesday, April 23, 2008 9:37 AM
> To: Seaside - general discussion
> Subject: Re: [Seaside] Integrating Images on a website. Don't want to
> useApache or WAFileLibrary.
>
> I think you should mantain all your assets outside the smalltalk image.
> Seaside it is very good with web apps, but it isn't very good at serving
> static content. The right tool for the right task. I use lighttpd on
> debian to serve all the images (*.jpg, *.gif), css (*.css), javascripts
> (*.js) for my app. It has a very small memory footprint, you can use it as
> a reverse proxy/load balancer to scale up your app (with several images
> running as workers  behind lighttpd, and user mod_proxy to serve the
> static content by itself and only delegating to seaside what it is your
> web app.
> My advice is: do not try to have all the things inside the image. It is
> going to revert back when you try to scale it (think of updating an jpg in
> your production app with a lot of smalltalk images working in parallel. A
> lot of pain)
>
> Miguel Cobá
>
>
> On Wed, Apr 23, 2008 at 7:46 AM, aditya siram <[hidden email]>
> wrote:
>
>
>       I am trying to incorporate images into my website.
>
>       However I would rather not use the methods listed in the "Resources"
> section of  the Seaside Tutorial at http://www.swa.hpi.uni-
> potsdam.de/seaside/tutorial. The CSS method reloads the image everytime,
> and the WAFileLibrary method inflates the Seaside image terribly. Using
> Apache as a proxy is not desirable because I am using Seaside mainly for
> its portability ie. I can stick the entire Seaside image on a flash drive
> and move the web-server from PC to PC with minimal hassle compared to
> other frameworks.
>
>       Is there some way to have the Seaside read the images  off some
> directory on the file system?
>
>       Deech
>
>
>
>       _______________________________________________
>       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: Integrating Images on a website. Don't want to use Apache or WAFileLibrary.

Holger Kleinsorgen-3
In reply to this post by mkobetic-2
Martin Kobetic schrieb:
> The extension is rather trivial as you can see in the attached file-out.
> It should file into Squeak fine, although there might be some VW
> specific bits in it, so you may have to fix it up for it to actually
> work in Squeak.

Works with some minor tweaking, see attached fileout.

'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 23 April 2008 at 9:41:54 pm'!
WAFileLibrary subclass: #WAExternalFileLibrary
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'SeasideForOpentalk'!
!WAExternalFileLibrary commentStamp: '<historical>' prior: 0!
This class adds the ability to serve content from files external to the image.

The files go in to a subdirectory from the running directory called 'files'
The URL to access the files is: http://localhost:7777/seaside/files/external/myfile.png

Seaside protects against malicious users attempting to use '..' to access above the 'files' directory.!


!WAExternalFileLibrary methodsFor: 'accessing' stamp: 'hkl 4/23/2008 21:40'!
documentAt: aFilename ifAbsent: aBlock
       
        | fn files mimeType fileStream |
        files :=  FileDirectory default directoryNamed: 'files'.
        files exists ifFalse: [^aBlock value].
        fn := files fullNameFor: aFilename.
        ^(files fileOrDirectoryExists: fn)
                ifTrue:
                        [mimeType := self mimetypeForFile: aFilename.
                        fileStream := (files readOnlyFileNamed: fn) binary.
                        (WAStreamResponse on: fileStream)
                                contentType: (mimeType ifNil: ['application/octet-stream']);
                                headerAt: 'Expires' put: 'Thu, 01 Jan 2095 12:00:00 GMT';
                                yourself]
                ifFalse: [aBlock value]! !

!WAExternalFileLibrary methodsFor: 'accessing' stamp: ' 23/4/08 11:00'!
urlOf: aSymbol using: aHandler
       
        ^(aHandler baseUrl)
                addToPath: 'external';
                addToPath: (self asFilename: aSymbol);
                yourself! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

WAExternalFileLibrary class
        instanceVariableNames: ''!

!WAExternalFileLibrary class methodsFor: 'testing' stamp: ' 23/4/08 11:00'!
handlesFolder: aSymbol
       
        ^aSymbol = #external! !

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