Serving static files from Comanche Re: [Seaside] listen on a single ip

Pierce Ng pierce at netmemetic.com
Mon Mar 29 12:05:21 UTC 2010


On Sun, Mar 28, 2010 at 10:47:59AM +0200, radoslav hodnicak wrote:
> WAComancheAdaptor>>createService
>     ^ (HttpService on: self port)
>         address: '127.0.0.1';
>         name: 'seaside-' , self port greaseString;
>         plug: self;
>         yourself

In case anyone prefers serving static files from Comanche instead of using
WAFileLibrary, here's an adaptation to Seaside 3 of some old code you may 
find on the net. (Note, I don't have the binding to 127.0.0.1 below.)

WAComancheAdaptor>>createServiceWithStaticPlug
    | contentPath dirPath service ma |

    contentPath := 'htdocs'.
    dirPath := FileDirectory default fullNameFor: contentPath.
    service := HttpService on: self port 
        named: 'seaside-', self port greaseString.
    ma := ModuleAssembly core.
    ma alias: '/static' to: [
        ma serverRoot: dirPath.
        ma documentRoot: dirPath.
        ma directoryIndex: 'index.html index.htm'.
        ma serveFiles ].
    ma addPlug: self.
    service plug: ma rootModule.
    ^ service




More information about the seaside mailing list