Le 26/07/2016 18:26, Tobias Boege a écrit :
> Hi Benoit,
> 
> I have some projects using gb.web.form now and in every of these I have the
> requirement not only to load webforms but also a webpage or to implement
> some other URL schema to generate or serve a ressource.
> 
> As I see it, gb.web.form wants to take complete control over the project's
> Main() routine (correct me if I'm wrong here), whereas my projects require
> some analysis of the request path in their Main() such as:
> 
>   Select Case Mid$(Request.Path, 2)
>     Case "favicon.png"
>       sPath = Server.DataDir &/ "favicon.png"
>       If Exist(sPath) Then
>         Response.SendFile(sPath)
>       Else
>         Response.SendFile("default.png")
>       Endif
> 
>     Case Like "data:*" ' server data
>       Response.SendFile(Server.DataDir &/ Mid$(Request.Path, 7))
> 
>     Case Like "?*:*" ' possibly user data, might also be /lib:0.0.1.js from 
> gb.web.form
>       ' Note that this URL is not protected by the session
>       With Scan(Mid$(Request.Path, 2), "*:*")
>         If Users.Exist(.[0]) Then
>           Users[.[0]].SendFile(.[1])
>         Else
>           Goto _Default
>         Endif
>       End With
> 
>     Case "upload"
>       ' ...
> 
>     :
>     : ' Other special URLs and URL schemata
>     :
> 
>     Case "" ' root
>       If CheckSession() Then Return
>       Home.Run()
> 
>     Default
>     _Default:
>       ' XXX: This is a hack to get gb.web.form data and to pipe its javascript
>       '      magic through.
>       With Scan(Request.Path, "/*/*")
>         If .Count Then
>           Try Class.Stat(.[0])
>           If Error Then
>             Request.Path = "/" &/ File.Name(Request.Path)
>           Endif
>         Endif
>       End With
>       WebForm.Main()
>   End Select
> 
> I have to serve data from a preconfigured server directory, generate some
> data on-the-fly, send project-internal data or serve webforms. As you may
> be able to tell, the Default case handles gb.web.form integration into the
> control flow and it's not pretty.
> 
> Do you have any idea?
> 
> Regards,
> Tobi
> 

Yes, the idea of gb.web.form requires taking entire control of the URL
at the moment.

Maybe adding a call to a "HandleRequest" (or another name) public method
during the Main function would be enough for you?

-- 
Benoît Minisini

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to