by
allistar >> Thu, 16 Jan 2003 8:09:54 GMT
I would be interested in what other people think of this concept, and what possibilities you see for it's use.
It looks great, very clean syntax. I know quite a few of us have done things very similar with web development in jade.
I think the biggest benifit by this kind of aproach is that it combines standard web development methodologies and tools and integrates it cleanly with your business objects and data in jade.
Some of the questions i would have are:
- How rich are the programming constructs in the script page? Can you define additional methods (or classes) on the same script page?
Each JHP block is one method, that allows you to access anything in the Jade database.
- How rich are the utility routines? i.e. HTML & URL Encode/Decode?
The URL decoding is handled by the Apache module (it parses the parameters from the URL and allows those parameters to be embedded in the Jade code in Perl syntax (i.e. prefixed with a $). This is for both POST and GET type variables).
- What kind of templating functions or page building methods does it support (ie "custom tags", "page includes", "server side controls", "XSL" ?)
The JHP schema is very basic, at the moment it is quite low level in that it allows you to embed Jade code in a web page and display the result in place of the Jade code.
I have intentionally left it quite low level, anything like session security, server side includes etc. is an exercise for the developer (server side includes would be very simple, simple echo back the contents of a file that reside on the Jade server machine (or maybe a SLOB in the database). JHP simply provides the access to the Jade database.
As an aside, I am currently developing a shopping cart/ordering demo using JHP. This has me designing session tracking into JHP (actually in a superschema of JHP).
- Can you call the script file directly, or do you have to pass it through as a parameter to the ISAPI DLL, CGI file, or apache mod?
It is only an Apache module. Any file with the extension "jhp" is passed through the JHP module and processed (just like PHP).
- Do you have easy access read and set information in the HTTP headers of the request and response?
At the moment I haven't allowed the HTTP headers to be modified by the Jade code (although you can put Jade code in between the <HEAD> and </HEAD> tags so you can put in things like META-EQUIV refresh statements).
You can read POST (int the headers) and GET information (from the URL).
- How cleanly and transparently is session state handled? What kind of options are there to persist the session identifier on the client?
JHP is lower level than that. With the ordering demo I am developing I do this by having a shared transient instance that gets created when the user logs in. This is then passed around the web sites as either a GET or POST variable.
- Can you directly invoke "servlets" inside the database?
The Jade code you embed in the web page can do anything you could do in a normal Jade method (except for GUI). This could include executing an external application in Jade, sending emails from Jade, printing. Anything.
The idea is that you build up a framework that sits between your application schema and the JHP schema. That framework could include things such as session management, security, HTML formatting code etc. I hope to have a few such frameworks available, and if JHP becomes popular then I would like to see those shared amongst the community,
- Whats the performance and scalability like? Can you have multiple request
being handled simultaniously? Can several web servers and jade clients be used to handle the load? Can large responses be written to the web client as their being generated?
I have designed this in a listener/worker model. That is that the listener takes the incoming JHP requests and passes them onto a worker. The workers must exist on the same node as the listener as shared transients are used. The number of workers is configurable, and allows multiple requests to be handled at once.
I have not yet done a lot of scalability testing. (I only have a Linux box at home, and the Jade database is 30km away in the city accessable over a PPTP connection over ADSL, which isn;t exactly the most efficient way of running it. Even in that configuration pages are still served with 1-2 seconds (which includes looping through objects in Jade and outputting them to an HTML table)).
- Can it easily handle other types of content? (i.e. XML, WML, images, SOAP calls)
I am going to investigate how to allow a browser to upload files through the Apache module into Jade. I don;t know much about how that works so will have to do a bit of research.
I ummed and arred about using SOAP but didn;t want the expense of unwrapping the XML. Efficiency was a goal and since there is only one thing that this can do - send Jade code - it was a no brainer to implement a simple TCP/IP protocol for the transfer from Apache mod to Jade server.
- Reliablity? Will a application session survive a web server going down? A database restart?
That depends on your implementation of sessions. The way I have implemented session management in my demo is to create a shared transient in the Jade process. This means that is the Apache server goes down the session is still "alive"/ I have also built in a natural timeout on the session (if it is not used within a certain amount of time then it is considered to be "dead").
- Security? Are config files secure? Can a session id be faked? Can users read or execute arbritrary code?
The user cannot inject Jade code to be executed into a webpage. All code is on the server side. Anyone with access to the actual .jhp files can do whatever they want (as with ASP or PHP).
The only config file that needs modifying is: /etc/httpd/conf/commonhttpd.conf
and
/etc/httpd/conf/http.conf
They are as secure as your Linux box is (you need root access to modify them).
Faking session id is up to the way you are implementing them. The way I am doing it for my demo is this:
a session id is valid if:
- a shared transient instance for that id exists
- the client IP address fo the current request is that same as the client IP that created the session
- the session havs not timed out.
Ive had to deal with most of these issues here. Finding the answers for our own solution in Jade was always fun
I have found developing session management interesting. At the moment a session is represented by the object id of the shared transient session object. Not exactly foolproof but I will encrypt that for production.
Thanks for the comments. I am familiar with other ways of interfacing between a Jade database and the web (jadehttp.dll and SOAP) and have recently been playing around with PHP. It struck me that server side preprocessing of HTML allows for very rapid and easy design of a website. I looked at PHP and made the logical jump to PHP.
Regards,
Allistar.
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst
allistar@silvermoon.co.nz
Auckland, NEW ZEALAND
Silvermoon Software
Specialising in JADE development and consulting
Visit us at:
http://www.silvermoon.co.nz ------------------------------------------------------------------