Here's how you can simplify the server startup method in ABMApplication.bas by converting StartServer() to a shim.
B4X:
public Sub StartServer(srvr As Server, srvrName As String, srvrPort As Int)
StartServerHTTP2( srvr, srvrName, srvrPort, 0, "", "", "" )
End Sub
public Sub StartServerHTTP2(srvr As Server, srvrName As String, srvrPort As Int, SSLsvrPort As Int, SSLKeyStoreFileName As String, SSLKeyStorePassword As String, SSLKeyManagerPassword As String)
ABM.WriteAppLauchPageToDisk(AppPage, File.DirApp & "/www/" & ABMShared.AppName, "index.html", ABMShared.NeedsAuthorization)
' Init the server
srvr.Initialize(srvrName)
If ( SSLsvrPort <> 0 ) Then
Dim ssl As SslConfiguration
ssl.Initialize
ssl.SetKeyStorePath(File.DirApp, SSLKeyStoreFileName) 'path to keystore file
ssl.KeyStorePassword = SSLKeyStorePassword
ssl.KeyManagerPassword = SSLKeyManagerPassword
srvr.SetSslConfiguration(ssl, SSLsvrPort)
srvr.Http2Enabled = True
End If
srvr.AddFilter("/js/b4j_ws.min.js", "ABMSessionCreator", False)
srvr.AddWebSocket("/ws/" & ABMShared.AppName, "ABMApplication")
For i =0 To Pages.Size - 1
srvr.AddWebSocket("/ws/" & ABMShared.AppName & "/" & Pages.Get(i) , Pages.Get(i))
If PageNeedsUpload.Get(i) Then
srvr.AddHandler("/" & ABMShared.AppName & "/" & Pages.Get(i) & "/abmuploadhandler", "ABMUploadHandler", False)
End If
Next
srvr.AddBackgroundWorker("ABMCacheScavenger")
srvr.Port = srvrPort
#If RELEASE
srvr.SetStaticFilesOptions(CreateMap("cacheControl": "max-age=604800,public","gzip":True,"dirAllowed":False))
#Else
srvr.SetStaticFilesOptions(CreateMap("cacheControl": "max-age=604800,public","gzip":False,"dirAllowed":False))
#End If
srvr.Start
Dim jo As JavaObject = srvr
Dim connectors() As Object = jo.GetFieldJO("server").RunMethod("getConnectors", Null)
Dim timeout As Long = ABMShared.SessionMaxInactiveIntervalSeconds*1000
For Each c As JavaObject In connectors
c.RunMethod("setIdleTimeout", Array(timeout))
Next
ABMShared.CachedPages = srvr.CreateThreadSafeMap
End Sub