[Seaside] Serve static files with WAKom (was: Bespin integration)
laurent.laffont at gmail.com
Tue Sep 14 18:50:26 UTC 2010
finally I've managed to serve static files without using an external web
server. Indeed I want to have a standalone application that's why I don't
want to use an external web server.
Here's how I did, It looks hacky so I'm looking for better code. It was
little modifications to make it works.
Object subclass: #SeaslidesServer
| ma seaside |
"Kill all existing Kom HTTP servers"
HttpService allInstancesDo: [:each | each stop. each unregister].
adaptor := (WAKom startOn: 8080).
ma := ModuleAssembly core.
ma serverRoot: (FileDirectory default directoryNamed: 'Bespin') fullName.
ma alias: '/seaslides' to: [ma addPlug: [:request | self
ma alias: '/files' to: [ma addPlug: [:request | self processHttpRequest:
ma documentRoot: (FileDirectory default directoryNamed: 'Bespin')
ma directoryIndex: 'index.html index.htm'.
adaptor service plug: ma rootModule.
SeaslidesServer class>>processHttpRequest: aRequest
^ self adaptor process: aRequest
The directory Bespin is at the same level at the Seaside image. So I can
access http://localhost:8080/BespinEmbedded.js and all other ressources.
http://localhost:8080/seaslides is my application.
http://localhost:8080/files is needed for Seaside libraires.
On Sat, Sep 11, 2010 at 9:47 AM, Philippe Marschall <
philippe.marschall at gmail.com> wrote:
> 2010/9/11 laurent laffont <laurent.laffont at gmail.com>:
> > Hi,
> > I'm trying to create a WAFileLibrary subclass and import Bespin
> > Embedded. https://bespin.mozillalabs.com/docs/embedding/index.html
> > However, Bespin expects this file hierarchy to work:
> > ressources/
> > -- screen_theme/
> > -- theme.less
> > -- images
> > lines.png
> > ....
> > With WAFileLibrary the path to files is built using the class name.
> > Is there a way to choose the directory name for a WAFileLibrary ? So I
> > access theme.less like this:
> > http://localhost:8080/BespinLibrary/ressources/screen_theme/theme.less
> > I know I can serve static filesusing an external Web server but I really
> > want to put this in the image. (Or, if possible, serve static files
> > via KomHttpServer or another Web server running on another port).
> > Laurent Laffont
> The easiest is probably to create a file handler named 'resources' and
> override #name in your file library to answer 'screen_theme'.
> seaside mailing list
> seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside