From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b1150caefb87348f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-05 02:17:51 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-08!supernews.com!freenix!wanadoo.fr!not-for-mail From: Pascal Obry Newsgroups: comp.lang.ada Subject: Re: Ada Advocacy - WPG (Web Page Generation) scheme Date: 05 Oct 2003 11:17:46 +0200 Organization: Home - http://perso.wanadoo.fr/pascal.obry Message-ID: References: NNTP-Posting-Host: avelizy-103-1-5-191.w80-13.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news-reader2.wanadoo.fr 1065345468 14293 80.13.115.191 (5 Oct 2003 09:17:48 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 5 Oct 2003 09:17:48 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.95 Xref: archiver1.google.com comp.lang.ada:254 Date: 2003-10-05T09:17:48+00:00 List-Id: "Nick Roberts" writes: > I've had an idea (not a blindingly original one) which might be a way to > help promote Ada. Dynamic web content is all the rage these days; there are > dozens of techniques used by millions of people to achieve it, including but > not limited to SSI, ASP, JSP, PHP, CGI, and many other acronyms. > > How to get Ada into this picture? By looking at AWS :) > I think one of the big attractions of schemes like ASP, JSP, and PHP (to > name but three) is that to use them you merely have to embed a few special > directives into an otherwise ordinary HTML file, and often the directives > are very simple. Yep, but in many places you have scripts and this is plain wrong. Having script into a Web page is mixing layout (HTML) and code. Both must really be separated, one of the reason is that they are done by differents peoples. > So, it seems to me, an attractive scheme would be to allow Ada code to be > embedded into an HTML file. No, I don't think this is right. Note that Java is moving on the opposite side just because of this problem. A script in a page means bugs in Web document, this is wrong. Look at the Java struts. In AWS we have a Templates_Parser engine which can compile on-the-fly templates file and interpret them. This is really quick and only some "tags" needs to be added into the HTML (or whatever) document. > A special program would transform this file into > a complete Ada program (procedure Main is ...) in a .adb file. The Ada > program would be a complete CGI program: you upload it, and compile it into > your cgi-bin directory. This is again the wrong way. CGI (Common Gateway Interface) is the old way to develop Web apllications. A CGI have to be spawned, this is a new process on the server side. This scheme has been dropped long time ago for the Application Server framework (JSP, ASP, PHP...). > It could 'with' a simple package providing support > for the CGI protocol (and HTTP/HTML web page generation); I'm aware of an > existing AdaCGI package that might suit this. Which must be history now :) > Since a TLA (three-letter acronym) seems to be obligatory for these things, Good, lets go with AWS :) > we might call it 'WPG' for Web Page Generation. The source file containing > the HTML with embedded Ada could then have the .wpg extension. Other > possibilities that occur to me are: DWP (Dynamic Web Pages); HRA (Hypertext > Response with Ada). The sillier the better, really. > > The special program doing the translation (from WPG to Ada) - let's call it > the WPGT - would (naturally!) be written in Ada, and I think it should be > quite simple to write. Obviously I'm volunteering, if nobody else makes a > claim. Ok, this is Templates_Parser (see AWS.Templates). BTW, AWS's templates engine is very fast. Lot faster than JSP, PHP or ASP. > I propose the following embedding syntax. [example removed] BTW, I found it quite unreadable. > One big selling point would be that your dynamic web pages are generated by > a native code compiled program; a bit more efficient than a script. Another > point is that you have the full facilities of Ada programming available to > you (utility packages, bindings, and so on). In AWS, the "scripts" are compiled into your main application. > Other possibilities include: allow the name of a package to be 'withed' > between [+ +] brackets; provide some handy translation-time values, e.g. > [?UPDATE?] to be replaced by the date and time the translation is executed. > > Some issues I can see are: > > (1) HTTP headers. You'll see my example program above generates one HTTP > header line. I get the impression that the headers a CGI program is supposed > to generate are not very well defined anywhere. I think AdaCGI has a > procedure to generate CGI headers; handy, but correct? Supported in AWS. > (2) Conversion of < > and & characters into escaped forms in fields. I think > AdaCGI has a function to do this; could it be done automatically? Supported in AWS. > (3) Access to databases. Most CGI programs and web scripts need to get their > information from a database, and some update databases too. I'm aware of a > project to produce a binding to PostgreSQL and MySQL; might this be what is > needed? Supported in AWS, just use GNADE or whatever binding to ODBC, MySQL... > (4) Most hosting companies don't allow binary CGI programs, for "security > reasons" (i.e. their own stupidity). Of those which do, many refuse to > install GNAT (despite providing GCC C++). Outrageous. However, I know at > least one hosting company (Liquid Web, http://www.liquidweb.com/ ) who is > willing to install GNAT, so maybe this isn't a hopeless problem. This is a real problem. Not solved, you need to use PHP... > Comments? Please have a look at AWS before doing this. As I said most of the ideas here are old-fashioned way to build Web applications. Also note that a Web server is only a start. You'll need to support SOAP, WSDL, SMTP, LDAP... to build real Web applications... All these standard are supported by AWS. Just in case : http://libre.act-europe.fr/aws Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://perso.wanadoo.fr/pascal.obry --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595