|
Class: WebServerStartup
Object
|
+--StandaloneStartup
|
+--WebServerStartup
- Package:
- stx:projects/webServer
- Category:
- demos-Standalone-applications
- Version:
- rev:
1.67
date: 2019/08/19 17:21:04
- user: stefan
- file: WebServerStartup.st directory: projects/webServer
- module: stx stc-classLibrary: webServer
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
actions
-
setServerSettingsFor: aServer fromArguments: argv
-
helpers
-
redirectStandardStreams
-
(comment from inherited method)
redirect all output for Transcript to stderr
-
serverForSettingsFilename: aFilename
-
startup
-
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
-
isHeadless
-
-
main: argv
-
double stack size because of the stc needs more stack in standalone app
-
usage
-
self usage
actions
-
addRunningServer
-
-
removeRunningServer
-
initialization
-
initialize
-
self basicNew initialize
startup
-
createServerFromArguments: argv
-
start server and search for some parameters
-
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
-
startServerFromArguments: argv
-
-
startServersFromArguments: argv
-
start one or more servers as specified on the command line
and wait until the last server has terminated
WebServerStartup main
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.
|
|