[Newbies] Launch a service to start the image

Hervé Darce squeak at moncase.fr
Tue Oct 14 08:01:48 UTC 2008


Randal L. Schwartz a écrit :
>>>>>> "Hervé" == Hervé Darce <squeak at moncase.fr> writes:
>>>>>>             
>
> Hervé> I want to launch at startup of the image this:
>
> I handled this by adding the startup/shutdown stuff to a class
> in my package that holds my WaKom initialization.  The simplest
> version of this would be:
>
>     MyClass class >> initialize
>
>       Smalltalk addToStartUpList: self.
>       Smalltalk addToShutDownList: self.
>       self startUp.
>
>     MyClass class >> startUp
>
>       self start. "in case I want more things here"
>
>     MyClass class >> start
>
>       | ma seaside |
>       seaside := WAKom default.
>       ma := ModuleAssembly core.
>       ma serverRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName.
>       ma
>         alias: '/seaside'
>         to: [ma addPlug: [:request | seaside process: request]].
>       ma documentRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName.
>       ma directoryIndex: 'index.html index.htm'.
>       ma serveFiles.
>       (HttpService startOn: 9090 named: 'httpd') plug: ma rootModule.
>
>     MyClass class >> shutDown
>
>       self stop.
>
>     MyClass class >> stop
>
>       HttpService allInstancesDo: [:each | each stop. each unregister].
>
>   
Thanks, It's ok now.

cheers

Herve Darce


More information about the Beginners mailing list