Class WebServer
java.lang.Object
net.simplace.sim.wrapper.web.WebServer
Web client of SIMPLACE: a server of its own (Javalin, own port) that offers a browser page to run a solution,
optionally with a project, a project table or a sensitivity analysis, to follow progress and log, to look at the
CSV outputs as diagrams and to download them (see
WebInterface). Like every binding it uses only the
public SimplaceWrapper API; it is independent of the REST wrapper (net.simplace.sim.wrapper.rest).
The directories are set once at start, from the environment (main) or by FWSimConsole (command "web"), because FWSimEngine keeps them process-wide.
Environment variables (main): SIMPLACE_WORK_DIR (required) SIMPLACE_OUTPUT_DIR (required) SIMPLACE_PROJECTS_DIR (optional, default = WORK_DIR) SIMPLACE_DATA_DIR (optional, default = WORK_DIR) SIMPLACE_CHECK_LEVEL (optional, e.g. LAZY/INTENSE/OFF) WEB_PORT (optional, default 7080) SIMPLACE_WEB_CONFIG (optional, default web.properties in the working directory: login, see WebConfig)Started directly (main) or from FWSimConsole via reflection (command "web", see
startFromConsole(Integer, String)): simplace_core itself must not compile against Javalin/Jetty
(lib/rest), so FWSimConsole does not import this class.- Author:
- Andreas Enders, Claude (Anthropic), co-author
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPort if neither WEB_PORT nor a port option is given. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidConfigures the engine from the environment variables and starts the server.static voidstartFromConsole(Integer aPort, String aConfigFile) Entry point for FWSimConsole (command "web"); the directories are already set by FWSimConsole.static io.javalin.JavalinstartOnPort(int aPort, WebConfig aConfig) Starts the server on a port and returns it (for tests: stop it afterwards).
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORTPort if neither WEB_PORT nor a port option is given.- See Also:
-
-
Method Details
-
main
Configures the engine from the environment variables and starts the server.- Parameters:
args- not used
-
startFromConsole
Entry point for FWSimConsole (command "web"); the directories are already set by FWSimConsole.- Parameters:
aPort- port,nullfor WEB_PORT or 7080aConfigFile- properties file with the login,nullfor web.properties in the working directory
-
startOnPort
Starts the server on a port and returns it (for tests: stop it afterwards). Expects the engine directories to be set already.- Parameters:
aPort- port to listen onaConfig- login- Returns:
- the started Javalin instance
-