:Namespace Boot MSRoot←{(1-⌊/'/\'⍳⍨⌽⍵)↓⍵}⎕WSID enlist←{⎕ML←1⋄∊⍵} try←{0::'' ⋄⍎⍵} ∇ End;classes;z;m ⍝ Clean up the workspace :If 9=⎕NC'ms' ms.End {}try'⎕EX⍕⊃⊃⎕CLASS ms.SessionHandler' {}try'⎕EX⍕⊃⊃⎕CLASS ms.Authentication' {}try'⎕EX⍕¨∪enlist ⎕CLASS¨ms.Encoders' ⎕EX⍕⊃⊃⎕CLASS ms ⎕EX'ms' :EndIf :If 9=⎕NC'SQA' {}try'SQA.Close''.''' :EndIf :If 0≠⍴classes←↓#.⎕NL 9.4 :AndIf 0≠⍴classes←(m←2=⊃∘⍴¨z←⎕CLASS¨#⍎¨classes)/classes classes←(#.MildPage≡¨2 1∘⊃¨m/z)/classes #.⎕EX↑⍕¨classes ⍝ Erase loaded classes :EndIf Load 0 ⎕EX'AppRoot' ∇ ∇ ms←Init Config;path;class;classes;e;res;mask ⍝ Create instances of MildServer, Session and Authentication Handlers ms←⎕NEW(#⍎Config.ClassName)Config path←MSRoot,'Extensions/' :If 0≠⍴Config.SessionHandler class←⎕SE.SALT.Load path,Config.SessionHandler ms.SessionHandler←⎕NEW class ms :EndIf :If 0≠⍴Config.Authentication class←⎕SE.SALT.Load path,Config.Authentication ms.Authentication←⎕NEW class ms :EndIf :If 0≠⍴Config.SupportedEncodings {}⎕SE.SALT.Load path,'ContentEncoder' :For e :In Config.SupportedEncodings class←⎕SE.SALT.Load path,e ms.Encoders,←⎕NEW class :EndFor :If ∨/mask←0≠1⊃¨res←ms.Encoders.Init 2 ms.Log'Content Encoding Initialization failed for:',∊' ',¨mask/ms.Encoders.Encoding ms.Encoders←(~mask)/ms.Encoders :EndIf :EndIf Config.UseContentEncoding∧←0≠⍴ms.Encoders ∇ ∇ Load yes;files;f;classes;class;utils ⍝ Note: DRC, XML, SOAP namespaces are not SALTed classes←(⎕SE.SALT.List AppRoot,'Code -raw')[;2] ⍝ Classes in application folder utils←(⎕SE.SALT.List MSRoot,'Utils -raw')[;2] ⍝ find utility libraries :If yes files←'Core/'∘,¨'MildServer' 'HTTPRequest' files,←'Utils/'∘,¨utils :For f :In files ⎕SE.SALT.Load MSRoot,f,' -target=#' :EndFor :If 0≠⍴classes :For class :In classes ⎕SE.SALT.Load AppRoot,'Code/',class,' -target=#' :EndFor :EndIf 'Pages'#.⎕NS'' ⍝ Container Space for loaded classes ⎕SE.SALT.Load MSRoot,'Core\MildPage -target=#.Pages' :Else ⍝ Cleanup #.⎕EX¨classes #.⎕EX¨utils #.⎕EX'Pages' #.⎕EX¨'MildServer' 'HTTPRequest' :EndIf ∇ ∇ Run root;Config;file AppRoot←root,(~(¯1↑root)∊'\/')/'/' Load 1 Config←(#.XML.ToNS #.Files.GetText AppRoot,'Config/Server.xml').Server Config.Port←2 1⊃⎕VFI Config.Port Config.TrapErrors←1=2 1⊃⎕VFI Config.TrapErrors Config.Debug←2 1⊃⎕VFI Config.Debug Config.Root←MSRoot{((~':'∊⍵)/⍺),⍵}AppRoot Config.TempFolder←Config.Root{((~':'∊⍵)/⍺),⍵}Config.TempFolder Config.UseContentEncoding←1=2 1⊃⎕VFI Config.UseContentEncoding ⍝ aka HTTP Compression Config.SupportedEncodings←{(⊂'')~⍨1↓¨(⍵=⊃⍵)⊂⍵}',',Config.SupportedEncodings Config.LogMessageLevel←2 1⊃⎕VFI Config.LogMessageLevel :If 0≠⎕NC'#.DrA' ⍝ Transfer DrA config options {}#.DrA.SetDefaults #.DrA.Mode←2 ⍝ Developer mode #.DrA.Path←AppRoot ⍝ Where to put log files #.DrA.SMTP_Gateway←Config.SMTP_Gateway #.DrA.MailRecipient←Config.MailRecipient #.DrA.MailMethod←Config.MailMethod #.DrA.AppName←Config.Name :EndIf ms←Init Config ⍝ Create instance of MildServer, Session and Authentication handlers ⍝ load any datasource definitions :If #.Files.Exists file←AppRoot,'Config/Datasources.xml' :AndIf 0<⍴ms.Datasources←(#.XML.ToNS #.Files.GetText file).Datasources :AndIf 0<⍴(⊂'ODBC')∨.≡ms.DataSources.Type :Trap 0 :If 0=#.⎕NC'SQA' 'SQA'⎕CY'SQAPL' ⍝ copy in SQA :EndIf :If 0≠1⊃SQA.Init'' ⍝ and initialize 1 ms.Log'SQA failed to initialize' :EndIf :Else 1 ms.Log'SQA failed to initialize' :EndTrap :EndIf ms.Run ∇ :EndNamespace