Using a simple WUI explore HTML5, and CSS3 design. From the assembly start the web server that provides static and dynamic content.
In this article we present the realization of a simple web server that allows the publication of a WUI (Web User Interface).
First, we will create a package containing the assemby (executable code), a GUI (monitor), a WUI (myWeb) and three resources: two images (Bnr, smile) and a background for the GUI (sfd).
GUI (Graphic User Interface)
The purpose of the GUI is to provide a feed back about the running state of the program and a way to terminate it. The GUI content only a tittle and a label.
The WUI (Web User Interface)
The WUI contains the index.html page and the smile _FRGM_ that is instanced 3 times inside the _REF_ element of the page.
The Monitor in the CLOSE item of the trig set to 1 the global variable stop@\Main (see next).
The main EXO does a simple work: preset to 0 the stop symbol, fill the TEXT of the GUI label with a message, set the title of the GIU and sent it the command to Show, call the SetUp method of the Web VAR, then wait inside a loop till the stop symbol goes to 1.
The web VAR contains some global symbol and three methods: SetUp, TrigGet and Close (unused in this demo),
With the WUI_OPN the MyWeb WUI is opened and the pointer (PTR) is saved in a global symbol of the VAR. The next operation are related to web. With WEB_NEW the service is created, to it a TRIG is associated to serve HTTP GET requests, and then is STARTED.
At any HTML GET request a TrigGet Method of the VAR WEB is started as a new thread. The set parameter are filled with the data of the call.
If the reqUrl parameter is emply , is filled with "index.html". In LBL Normalization , slash are normalized and the first of it, if exist, is removed.
In the IF item the core of the WUI generation, in fact if the rqsUrs is an .html page, with the function WUI_HTML the genaration proces is activated. If the function return a valid htm symbol, that is, containing the HTML code, the TRIG return it to the requester browser.
The code inside the last LBL serve static contents from the web dir, (not user here, you should define the symb in VAR). In fact in this demo, static image are keept from the package and the proper link is generated by the WUI_HTML function.