eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'WebServerStartup':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: WebServerStartup


Inheritance:

   Object
   |
   +--StandaloneStartup
      |
      +--WebServerStartup

Package:
stx:projects/webServer
Category:
demos-Standalone-applications
Version:
rev: 1.66 date: 2018/05/16 09:11:20
user: cg
file: WebServerStartup.st directory: projects/webServer
module: stx stc-classLibrary: webServer

Description:


a non-graphical demo application;
when built, it creates an executable which starts
a webServer (HTTPServer - comparable to apache).

Command-line arguments:
    see WebServerStartup usageLines asString
[build with:]
    cd projects/webServer; make

[execute with:]
    cd projects/webServer; webServer


Class protocol:

actions
o  setServerSettingsFor: aServer fromArguments: argv

helpers
o  redirectStandardStreams

o  serverForSettingsFilename: aFilename

startup
o  allowDebugOption
enable/disable the --debug startup option.
The default is now false, so standAlone apps are closed by default.
Can be redefined in subclasses to enable it

o  isHeadless

o  main: argv
double stack size because of the stc needs more stack in standalone app

o  usage
self usage


Instance protocol:

actions
o  addRunningServer

o  removeRunningServer

initialization
o  initialize
self basicNew initialize

startup
o  createServerFromArguments: argv
start server and search for some parameters

o  setupErrorHandler
setup an error handler to not crash when something unexpected happens.
e.g. ComancheSwiki does some actions in forked processes, which do not
handle errors

o  startServerFromArguments: argv

o  startServersFromArguments: argv
start one or more servers as specified on the command line
and wait until the last server has terminated


Demonstration:


    WebServerStartup main


Examples:


check from non-headless Smalltalk; look at the terminal output Example 1:view the help file
    | args |
    args := OrderedCollection new.
    args add:'--help'.

    self new initialize startServersFromArguments:args.
Example 2:start from settings file
    | args |
    args := OrderedCollection new.
    args add:'--useFile'; add:'./webServerSettings.xml'.

    self new initialize startServersFromArguments:args.

Example 3:start from settings file and overwrite port
    | args |
    args := OrderedCollection new.
    args add:'--useFile'; add:'./webServerSettings.xml'.
    args add:'--port'; add:'8082'.

    self new initialize startServersFromArguments:args.
Example 3:start from settings file and overwrite logFile
    | args |
    args := OrderedCollection new.
    args add:'--useFile'; add:'./webServerSettings.xml'.
    args add:'--log'; add:'/tmp/foo'.

    self new initialize startServersFromArguments:args.
Example 4:start two servers in one image
    | args |
    args := OrderedCollection new.
    args add:'--useFile'; add:'./webServerSettings_8081.xml'.
    args add:self webServerSettingsSeperator.
    args add:' --useFile'; add:'./webServerSettings_8080.xml'.

    self new initialize startServersFromArguments:args.

Example 4:start two servers in one image
    | args |
    args := OrderedCollection new.
    args add:'--useFile'; add:'./webServerSettings_8081.xml'.
    args add:self webServerSettingsSeperator.
    args add:' --useFile'; add:'./webServerSettings_8080.xml'.

    self new initialize startServersFromArguments:args.



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 18 Nov 2018 08:18:11 GMT