wwServer::OnLoad

This event hook is fired exactly once when the first request hits the server.

It fires after the both OnInit() and OnInitCompleted() have fired, but it doesn't fire immediately after those events. Instead this event hook is only invoked once when the very first request hits the server.

Use this method to setup your application's environment. When this method is called the server has read all of its configuration settings so you can safely read values from the various configuration objects. For this reason this method, rather than OnInit() should be used to set any application specific settings.

Use OnLoad() to set up the application environment including SET PATH, any system SET commands. Use OnLoad() to adjust the server's operational properties, to add properties or objects, load class libraries etc. Anything application specific should be managed here.

o.OnLoad()

Remarks

This method is an abstract method and should always be implemented in your subclass of wwServer.

Example

PROTECTED FUNCTION OnLoad

*** Add persistent SQL Server Connection
#IF WWC_USE_SQL_SYSTEMFILES
    THIS.AddProperty("oSQL", CREATE("wwSQL"))
    IF !THIS.oSQL.Connect(THIS.oConfig.cSQLConnectString)
	   MESSAGEBOX("Couldn't connect to SQL Service. Check your SQL Connect string in the INI file.",48,"Web Connection")
	   CANCEL
    ENDIF
#ENDIF

*** Add any of YOUR data paths - SET DEFAULT is at EXE/Start path
SET PATH TO "..\Data" ADDITIVE
SET PATH TO "..\SupportFiles" ADDITIVE

*** Force .NET version to 4.0
DO wwDotnetBridge
InitializeDotnetVersion("V4")  && Use Version 4

*** Add any SET CLASSLIB or SET PROCEDURE code here
SET PROCEDURE TO wwThreadsBusinessClasses.prg ADDITIVE
SET PROCEDURE TO wwRegEx ADDITIVE 

SET ENGINEBEHAVIOR 70

ENDFUNC

See also:

Class wwServer

© West Wind Technologies, 1996-2018 • Updated: 01/27/18
Comment or report problem with topic