B4J Question [ABMaterial] Using FileInput inside a ModalSheet doesn't work (?)

Discussion in 'B4J Questions' started by Cableguy, Apr 14, 2019.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi Guys,

    I'm trying to use a FileInput component Inside a ModalSheet and all is working except for the UploadToServer.

    Here's my Code

    The component is declared in globals so that I can more easely reference it.

    In the Build ModalSheet
    Code:
    ModalSheetLogoHolderFileInput.Initialize(AppPage, "ModalSheetLogoHolderFileInput""Select a file""Open"True"""")
        ThisModalSheet.Content.Cell(
    1,2).AddComponent(ModalSheetLogoHolderFileInput)
    and the event

    Code:
    Sub ModalSheetLogoHolderFileInput_Changed(value As String)
     
    Log("value : " & value)
     ModalSheetLogoHolderFileInput.UploadToServer

    End Sub
    But in the logs i'm getting

    Code:
    2019-04-14 18:12:01.757:INFO:oejs.AbstractConnector:main: Started ServerConnector@31fa1761{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
    2019-04-14 18:12:01.763:INFO:oejs.Server:main: Started @8940ms
    Emulated network latency: 100ms
    2019-04-14 18:12:01.820:INFO:oejs.AbstractConnector:main: Stopped ServerConnector@31fa1761{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
    2019-04-14 18:12:01.821:INFO:oejs.session:main: node0 Stopped scavenging
    2019-04-14 18:12:01.831:INFO:oejsh.ContextHandler:main: Stopped o.e.j.s.ServletContextHandler@4de4b452{/,file:///C:/B4X%20Suite/B4J%20Projects/iFTTH%20Manager/iFTTH%20Manager/Objects/www/,UNAVAILABLE}
    2019-04-14 18:12:01.866:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
    2019-04-14 18:12:01.893:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@4de4b452{/,file:///C:/B4X%20Suite/B4J%20Projects/iFTTH%20Manager/iFTTH%20Manager/Objects/www/,AVAILABLE}
    2019-04-14 18:12:01.895:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\B4X Suite\B4J Projects\iFTTH Manager\iFTTH Manager\Objects\logs\b4j-2019_04_14.request.log
    2019-04-14 18:12:01.898:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
    2019-04-14 18:12:01.899:INFO:oejs.session:main: No SessionScavenger set, using defaults
    2019-04-14 18:12:01.899:INFO:oejs.session:main: node0 Scavenging every 600000ms
    2019-04-14 18:12:01.907:INFO:oejs.AbstractConnector:main: Started ServerConnector@31fa1761{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
    2019-04-14 18:12:01.908:INFO:oejs.Server:main: Started @9085ms
    2019-04-14 18:12:01.912:INFO:oejs.session:main: node0 Scavenging every 990000ms
    Viewer running on os: windows 10
    Trying to open: http://localhost:51042/iFTTH-Manager/
    Connected
    Waiting for value (101 ms)
    Waiting for value (101 ms)
    value : BaseV5.png
    /iFTTH-Manager/abmuploadhandler
    Not Found
    I'm just LOST
     
  2. Harris

    Harris Well-Known Member Licensed User

    Do you have a ABMUploadHandler class?
    There is more to this than you might expect...
    The demo (included in your ABM download) exposes more of the requirements.

    I have to dig into my code to fully explain this. It might take awhile - since I am still struggling trying to SSL my ABM webapp on my VPS. (not going well despite all the help).
     
    Cableguy likes this.
  3. Cableguy

    Cableguy Expert Licensed User

    I'm going back and foward between my project and the Demo project comparing things.

    I noticed the need to add some WS attributes on the socket conected and disconected events, and I've Added those, along with the global variables needed.

    No change, the result is the same.

    Important things to know:

    I'm canibalizing the Aplication page to be my single page, and I have deleted all the this that I Don't need (just yet).

    Here's my Aplication Page
    Code:
    'Main application
    Sub Class_Globals
        
    Private AppPage As ABMPage
        
    Private ws As WebSocket 'ignore
        Private ABM As ABMaterial 'ignore   
        Private Pages As List   
        
    Private PageNeedsUpload As List
        
        
    Public DownloadFolder As String = "/www/" & ABMShared.AppName & "/uploads/"
        
    Public DownloadMaxSize As String = 1000*1024
        
        
    Private ABMPageId As String = ""
        
    Public TopBar As PSGTopBar
        
        
    Dim ModalSheetLogoHolder As ABMImage
        
    Dim ModalSheetLogoHolderFileInput As ABMFileInput
    End Sub

    Public Sub Initialize
        Pages.Initialize   
        PageNeedsUpload.Initialize
        ABM.AppVersion = ABMShared.AppVersion
        ABM.AppPublishedStartURL = ABMShared.AppPublishedStartURL
            
        
    ' add your icons
        ' ABM.AddAppleTouchIcon("", "")
        ' ABM.AddMSTileIcon("", "")
        ' ABM.AddFavorityIcon("", "")   
        
        
    #If RELEASE   
            'ABM.ActivateUseCDN("DONATORKEY", "https://cdn.jsdelivr.net/gh/RealAlwaysbusy/ABMaterial@v3.81-rc1/")
            'ABM.PreloadAllJavascriptAndCSSFiles=True    ' NEW
            ABM.ActivateGZip("DONATORKEY", 1000) ' NEW
        
            Dim folders As List ' NEW
            folders.Initialize
            folders.Add(File.DirApp & "/www/" & ABMShared.AppName & "/images")   
            ABM.ActivatePNGOptimize("DONATORKEY", folders, False , 9, False, True )
        
    #End If
        
        
    ' build the local structure IMPORTANT!
        BuildPage
    End Sub

    Private Sub WebSocket_Connected (WebSocket1 As WebSocket)   
        
    Log("Connected")
        ws = WebSocket1
        
        ABMPageId = ABM.GetPageID(AppPage, ABMShared.AppName,ws)
        
    '----------------------START MODIFICATION 4.00-------------------------------
        If AppPage.WebsocketReconnected Then
            ABMShared.NavigateToPage(ws, 
    """./")
            
    Return
        
    End If
        
        
    Dim session As HttpSession = ABM.GetSession(ws, ABMShared.SessionMaxInactiveIntervalSeconds) 'ignore   
        If session.IsNew Then
            session.Invalidate
            ABMShared.NavigateToPage(ws, 
    """./")
            
    Return
        
    End If
        
    '----------------------END MODIFICATION 4.00-------------------------------
            
        
    ' Prepare the page IMPORTANT!
        AppPage.Prepare   
        
        
    ' Run ConnectPage here in ABMApplication
        ConnectPage   
        
        
    ' this page uses uploads, so needs some settings
        ws.Session.SetAttribute("abmcallback", Me)
        ws.Session.SetAttribute(
    "abmdownloadfolder", DownloadFolder)
        ws.Session.SetAttribute(
    "abmmaxsize", DownloadMaxSize)
    End Sub


    Private Sub WebSocket_Disconnected
        
    Log("Disconnected")   
            
        
    Try
            ws.Session.RemoveAttribute(
    "abmcallback")   
            ws.Session.RemoveAttribute(
    "abmdownloadfolder")
            ws.Session.RemoveAttribute(
    "abmmaxsize")
        
    Catch
            
    Log(LastException.Message)
        
    End Try
    End Sub

    Sub Page_ParseEvent(Params As Map)
        
    Dim eventName As String = Params.Get("eventname")
        
    Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))
        
    If eventName = "beforeunload" Then
            
    Log("preparing for url refresh")
            ABM.RemoveMeFromCache(ABMShared.CachedPages, ABMPageId)
            
    Return
        
    End If
        
    Dim caller As Object = AppPage.GetEventHandler(Me, eventName)
        
    If caller = Me Then
            
    If SubExists(Me, eventName) Then
                Params.Remove(
    "eventname")
                Params.Remove(
    "eventparams")
                
    ' BEGIN NEW DRAGDROP
                If eventName = "page_dropped" Then
                    AppPage.ProcessDroppedEvent(Params)
                
    End If
                
    ' END NEW DRAGDROP
                Select Case Params.Size
                    
    Case 0
                        
    CallSub(Me, eventName)
                    
    Case 1
                        
    CallSub2(Me, eventName, Params.Get(eventParams(0)))
                    
    Case 2
                        
    If Params.get(eventParams(0)) = "abmistable" Then
                            
    Dim PassedTables As List = ABM.ProcessTablesFromTargetName(Params.get(eventParams(1)))
                            
    CallSub2(Me, eventName, PassedTables)
                        
    Else
                            
    CallSub3(Me, eventName, Params.Get(eventParams(0)), Params.Get(eventParams(1)))
                        
    End If
                    
    Case Else
                        
    ' cannot be called directly, to many param
                        CallSub2(Me, eventName, Params)
                
    End Select
            
    End If
        
    Else
            CallSubDelayed2(caller, 
    "ParseEvent", Params) 'ignore
        End If
    End Sub

    public Sub AddPage(Page As ABMPage)
        Pages.Add(
    Page.Name)   
        PageNeedsUpload.Add(ABM.WritePageToDisk(
    PageFile.DirApp & "/www/" & ABMShared.AppName & "/" & Page.Name & "/"Page.PageHTMLName, ABMShared.NeedsAuthorization))
    End Sub

    '----------------------START MODIFICATION 4.00-------------------------------
    public Sub StartServer(srvr As Server, srvrName As String, srvrPort As Int)       
        ABM.WriteAppLauchPageToDisk(AppPage, 
    File.DirApp & "/www/" & ABMShared.AppName, "index.html", ABMShared.NeedsAuthorization)

        
    ' start the server
        srvr.Initialize(srvrName)

        
    ' uncomment this if you want to directly access the app in the url without having to add the app name
        ' e.g. 192.168.1.105:51042 or 192.168.1.105 if you are using port 80
        'srvr.AddFilter( "/", "ABMRootFilter", False )
        
        
    ' NEW V3 Cache Control
        srvr.AddFilter("/*""ABMCacheControl"False)
        
    ' NEW 4.00 custom error pages (optional) Needs the ABMErrorHandler class
        srvr.SetCustomErrorPages(CreateMap("org.eclipse.jetty.server.error_page.global""/" & ABMShared.AppName & "/error")) ' OPTIONAL
        srvr.AddHandler("/" & ABMShared.AppName & "/error""ABMErrorHandler"False' OPTIONAL
        
        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("gzip":True,"dirAllowed":False))
        #Else       
            srvr.SetStaticFilesOptions(CreateMap("gzip":False,"dirAllowed":False))
        
    #End If
        
        srvr.Start       
        
        
    Dim joServer As JavaObject = srvr
        joServer.GetFieldJO(
    "server").RunMethod("stop"Null)
        joServer.GetFieldJO(
    "context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionCookieConfig"Null).RunMethod("setMaxAge"Array(31536000)) ' 1 year   
        
        
    ' NEW FEATURE! Each App has its own Session Cookie
        joServer.GetFieldJO("context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionCookieConfig"Null).RunMethod("setName"Array(ABMShared.AppName.ToUpperCase))
        joServer.GetFieldJO(
    "server").RunMethod("start"Null)
        
        
    Dim secs As Long = ABMShared.CacheScavengePeriodSeconds ' must be defined as a long, else you get a 'java.lang.RuntimeException: Method: setIntervalSec not matched.' error
        joServer.GetFieldJO("context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionIdManager"Null).RunMethodJO("getSessionHouseKeeper"Null).RunMethod("setIntervalSec"Array As Object(secs))
                
        
    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

    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)

        
    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)

        
    ' start the server
        srvr.Initialize(srvrName)
        
        
    ' uncomment this if you want to directly access the app in the url without having to add the app name
        ' e.g. 192.168.1.105:51042 or 192.168.1.105 if you are using port 80
        'srvr.AddFilter( "/", "ABMRootFilter", False )
        
        
    ' NEW V3 Cache Control
        srvr.AddFilter("/*""ABMCacheControl"False)
        
    ' NEW 4.00  custom error pages (optional) Needs the ABMErrorHandler class
        srvr.SetCustomErrorPages(CreateMap("org.eclipse.jetty.server.error_page.global""/" & ABMShared.AppName & "/error")) ' OPTIONAL
        srvr.AddHandler("/" & ABMShared.AppName & "/error""ABMErrorHandler"False' OPTIONAL
        
        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
        srvr.Http2Enabled = 
    True
        
        
    #If RELEASE       
            srvr.SetStaticFilesOptions(CreateMap("gzip":True,"dirAllowed":False))
        #Else       
            srvr.SetStaticFilesOptions(CreateMap("gzip":False,"dirAllowed":False))
        
    #End If
            
        srvr.Start
        
        
    Dim joServer As JavaObject = srvr
        joServer.GetFieldJO(
    "server").RunMethod("stop"Null)
        joServer.GetFieldJO(
    "context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionCookieConfig"Null).RunMethod("setMaxAge"Array(31536000)) ' 1 year
        
        
    ' NEW FEATURE! Each App has its own Session Cookie
        joServer.GetFieldJO("context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionCookieConfig"Null).RunMethod("setName"Array(ABMShared.AppName.ToUpperCase))
        joServer.GetFieldJO(
    "server").RunMethod("start"Null)
        
        
    Dim secs As Long = ABMShared.CacheScavengePeriodSeconds ' must be defined as a long, else you get a 'java.lang.RuntimeException: Method: setIntervalSec not matched.' error
        joServer.GetFieldJO("context").RunMethodJO("getSessionHandler"Null).RunMethodJO("getSessionIdManager"Null).RunMethodJO("getSessionHouseKeeper"Null).RunMethod("setIntervalSec"Array As Object(secs))
        
        
    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
    '----------------------END MODIFICATION 4.00-------------------------------

    public Sub BuildPage()
        
    ' initialize this page using our theme
        AppPage.InitializeWithTheme(ABMShared.AppName, "/ws/" & ABMShared.AppName, False, ABMShared.SessionMaxInactiveIntervalSeconds , ABMShared.MainTheme)
        AppPage.ShowLoader=
    True
        AppPage.PageTitle = 
    "iFTTH Manager"
        AppPage.PageDescription = 
    ""   
        AppPage.PageHTMLName = 
    "index.html"
        AppPage.PageKeywords = 
    ""
        AppPage.PageSiteMapPriority = 
    "0.00"
        AppPage.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
        AppPage.ShowConnectedIndicator = 
    True
            
        
    'AppPage.ShowGridInfo = True
            
        
    ' create the page grid
        AppPage.AddRows(1,False"").AddCells12(1,"")
        AppPage.BuildGrid 
    'IMPORTANT once you loaded the complete grid AND before you start adding components

        
    'Add TopBar to AppPage
        TopBar.Initialize(AppPage, "TopBar""""TopBar")
        AppPage.Cell(
    1,1).AddComponent(TopBar.TopBarContainer)
        
        
        AppPage.AddModalSheetTemplate(BuildPreferencesModalSheet)
    End Sub

    public Sub ConnectPage()
        
    ' you dynamic stuff
        
                
        AppPage.Refresh 
    ' IMPORTANT
        
        
    ' Tell the browser we finished loading
        AppPage.FinishedLoading 'IMPORTANT
        
        AppPage.RestoreNavigationBarPosition
        
        
    '
        AppPage.ShowModalSheet("PreferencesModalSheet")
    End Sub


    Sub BuildPreferencesModalSheet As ABMModalSheet
        
    Dim ThisModalSheet As ABMModalSheet
        ThisModalSheet.Initialize(AppPage, 
    "PreferencesModalSheet",FalseFalse"PreferencesModalSheet")
        
        ThisModalSheet.Header.AddRows(
    1,True,"").AddCells12(1,"")
        ThisModalSheet.Header.BuildGrid 
    ' IMPORTANT!
        
        
    Dim PreferencesModalSheetTitle As ABMLabel
        PreferencesModalSheetTitle.Initialize(AppPage, 
    "PreferencesModalSheetTitle""Aplication Preferences", ABM.SIZE_H5, False"PreferencesModalSheet")
        ThisModalSheet.Header.Cell(
    1,1).AddComponent(PreferencesModalSheetTitle)
        

        
    'ThisModalSHeet Content
        ThisModalSheet.Content.AddRowsV(1,True,ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"").AddCellsOSV(1,0,0,0,3,3,3,ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"").AddCellsOSV(1,0,0,0,9,9,9,ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"")
        ThisModalSheet.Content.AddRowsV(
    1,True,ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"").AddCells12(1,"")
        ThisModalSheet.Content.AddRowsV(
    2,True,ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"").AddCells12V(1, ABM.VISIBILITY_SHOW_ON_LARGE_ONLY,"")
        ThisModalSheet.Content.BuildGrid 
    ' IMPORTANT!
        
        
        ModalSheetLogoHolder.Initialize(AppPage, 
    "ModalSheetLogoHolder""../iFTTH-Manager/images/yourlogohere.png"1)
        ThisModalSheet.Content.Cell(
    1,1).AddComponent(ModalSheetLogoHolder)
        ModalSheetLogoHolder.SetFixedSize(
    15075)
        
        
        ModalSheetLogoHolderFileInput.Initialize(AppPage, 
    "ModalSheetLogoHolderFileInput""Select a file""Open"True"""")
        ThisModalSheet.Content.Cell(
    1,2).AddComponent(ModalSheetLogoHolderFileInput)


        ThisModalSheet.UseTheme(
    "PreferencesModalSheet")
        
    Return ThisModalSheet
    End Sub

    Sub ModalSheetLogoHolderFileInput_Changed(value As String)
        
    Log("value : " & value)
        ModalSheetLogoHolderFileInput.UploadToServer
    End Sub

    Sub Page_FileUploaded(FileName As String, success As Boolean)
        ModalSheetLogoHolderFileInput.Clear
        
    Log(FileName & " = " & success)
    End Sub

    and I'm still getting...

    Code:
    2019-04-15 15:31:29.491:INFO:oejs.Server:main: Started @4740ms
    Emulated network latency: 100ms
    2019-04-15 15:31:29.506:INFO:oejs.AbstractConnector:main: Stopped ServerConnector@2c1b194a{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
    2019-04-15 15:31:29.506:INFO:oejs.session:main: node0 Stopped scavenging
    2019-04-15 15:31:29.522:INFO:oejsh.ContextHandler:main: Stopped o.e.j.s.ServletContextHandler@6babf3bf{/,file:///C:/B4X%20Suite/B4J%20Projects/iFTTH%20Manager/iFTTH%20Manager/Objects/www/,UNAVAILABLE}
    2019-04-15 15:31:29.569:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
    2019-04-15 15:31:29.584:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@6babf3bf{/,file:///C:/B4X%20Suite/B4J%20Projects/iFTTH%20Manager/iFTTH%20Manager/Objects/www/,AVAILABLE}
    2019-04-15 15:31:29.584:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\B4X Suite\B4J Projects\iFTTH Manager\iFTTH Manager\Objects\logs\b4j-2019_04_15.request.log
    2019-04-15 15:31:29.584:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
    2019-04-15 15:31:29.584:INFO:oejs.session:main: No SessionScavenger set, using defaults
    2019-04-15 15:31:29.584:INFO:oejs.session:main: node0 Scavenging every 660000ms
    2019-04-15 15:31:29.584:INFO:oejs.AbstractConnector:main: Started ServerConnector@2c1b194a{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
    2019-04-15 15:31:29.584:INFO:oejs.Server:main: Started @4844ms
    2019-04-15 15:31:29.600:INFO:oejs.session:main: node0 Scavenging every 990000ms
    Viewer running on os: windows 10
    Trying to open: http://localhost:51042/iFTTH-Manager/
    Connected
    Waiting for value (112 ms)
    Waiting for value (156 ms)
    Waiting for value (109 ms)
    value : BaseV5.png
    /iFTTH-Manager/abmuploadhandler
    Not Found
     
  4. alwaysbusy

    alwaysbusy Expert Licensed User

    I'm wondering if the dashes (and/or) underscores you use in ids/names (e.g. iFTTH-Manager) isn't causing your troubles. It is juist this log is suggesting something in this line

    Code:
    /iFTTH-Manager/abmuploadhandler
    Not Found
    Just for test, try to rename your app as "iftthmanager"

    When pressing F12, console (and network) in the browser, do you see any errors?
     
    Last edited: Apr 15, 2019
  5. Cableguy

    Cableguy Expert Licensed User

    The console shows the same error, saying the /iftthmanager/abmuploadhandler is not found...

    I think I may restart the project, and go the "proper" way, leaving ABMApplication to do its thing...
    I've noticed that the Sockect Conect and the event parser sub have some sligth différences...

    I'll keep you posted about my work in progress.
     
  6. alwaysbusy

    alwaysbusy Expert Licensed User

    In canablizing, do you have even one page? Because if not, then it will never add an abmunloadhandler (and they are page specific too):

    Code:
    For i =0 To Pages.Size - 1  'will be 0
            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

    ' try adding this here:
    srvr.AddHandler("/" & ABMShared.AppName & "/abmuploadhandler""ABMUploadHandler"False)
     
  7. Cableguy

    Cableguy Expert Licensed User

    I guess that's the thing… I have one page, the ABMApplication page, that usually one uses as a "transparent" page just to call the real landing page...

    So, i'm now in the process of lobotomizing ( as oposed to canibalizing ) the Template and see how it goes.
     
  8. alwaysbusy

    alwaysbusy Expert Licensed User

    Just adding this did nothing? (it should at least find the handler now)

    Code:
    srvr.AddHandler("/" & ABMShared.AppName & "/abmuploadhandler""ABMUploadHandler"False' note no pages in here!
     
  9. Cableguy

    Cableguy Expert Licensed User

    Where should I add it?
     
  10. alwaysbusy

    alwaysbusy Expert Licensed User

    As I showed in post #6, right under where the pages add it (ABMApplication - StartServer/StartServerHttp2)
     
  11. Cableguy

    Cableguy Expert Licensed User

    OK, so that was NOT suposed to be deleted!!!! LOL...

    I'll be back in about 1h with (hopefully good) news
     
    Harris likes this.
  12. alwaysbusy

    alwaysbusy Expert Licensed User

    :):):)
     
  13. Cableguy

    Cableguy Expert Licensed User

    I got it WORKING!!!

    At the end… I was too canibalistic!
    Back to basics!
     
    Last edited: Apr 15, 2019
    alwaysbusy and Harris like this.
  14. alwaysbusy

    alwaysbusy Expert Licensed User

    Did you really think I put all that code in there for my amusement and to annoy you guys? :D
     
  15. Cableguy

    Cableguy Expert Licensed User

    No, I just thought I didn't need it… Like that Chinese guy who sold a kidny to buy an IPhone and ended up needing hemodialisis!
     
    alwaysbusy likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice