The dxp (dynamic xml page) system is a framework for building web applications. It compiles XML source pages with special tags into cached server objects that respond quickly to http requests. It’s normally used to interact with database tables and dynamically create html or xml content on the fly.
If you want to know why I bothered to create dxp when there are so many other template systems available you might read dxp-vs-jsp and dxp-vs-xslt. Some of the comments about jsp scripting also also apply php.
Pages are controlled by a DxpServlet that runs in a compatible servlet runner like Tomcat or Resin. Servlet Runners are often paired with Apache through a runtime module. The diagram below shows an Apache/Resin combination.
Passing a reaquest to a .dxp page
Page requests with the file extension .dxp are passed by Apache to a servlet module. The module talks to a servlet runner which is a Java based server listening on a private port. The servlet runner is configured to pass requests for .dxp pages to the DxpServlet. The servlet loads the DxpPage from it’s cache and passes on the client request. The output of the DxpPage is sent back to the client.
If the DxpPage is not found in the cache it’s compiled from the source file. If the page is found in the cache and it’s last compile time is beyond a certain time interval the source file will be checked to see if the page is out of date should be recompiled to a newer version. The default interval is 30 seconds but can be set manually. A page is removed from the cache if it has not been accessed for a while (configurable) or if the check for a matching source file does not find one.
In a typical setup, each Virtual Host contains a separate application zone with it’s own set of active pages and default services. Classes in one zone can be reloaded without affecting other Virtual Hosts. Connections to the appropriate database tables are allocated in advance.
The dxp system provides a set of resuable xml tags which serve as a web interface to a web application framework. You can use them to interact with a backend database and create dynamic content on the fly or to write static html pages at regular intervals that contain new database content. A good strategy is to create a set of reusable dxp and html sections (not full pages) that you can insert on the fly to create a complete page. You can change the look and layout of your site by changing a single section of code on one page. The Samples will help you get started.
The dxp framework is written in Java and runs in a compatible servlet runner. Active tags are created by subclassing the basic tag, com.neolectric.dxp.DxpNode. DxpNodes provide a web interface to run values in and out of your application classes. The intent is to promote reuseable objects that can be connected like building blocks to create multiple applications. The concept is similar to using a class library like the Java packages rather than writing all your Objects by hand each time you need them.
If you are more comfortable creating one of a kind applications through complex page scripting you may prefer jsp, php or python. If you get tired of rewriting scripting code each time you build a new application try dxp. It’s easy to create your own tags. The source code is extensively commented and attempts to explain how the system works and how to use all the tag options.
The dxp system attempts to protect the server and keep VirtualHosts from interfering with each other by placing limits on what page authors can do. The defuault tags are not allowed to read/write outside a document root you define for each Virtual Host and random scripting outside what the tags support is not compiled into active code. The default tags are safer on a multi-user system than jsp or php but custom tags can easily change this behavior and give the programmer access to the command shell owned by the user account running the Java VM. You can control which classes are loaded by assigning a different classpath to each Virtual Host and not allowing users to upload to these directories. The Config section contains setup information.
dxp Version 2 is the 4th in a series of template systems that began in 1998 when the author, Mark Ashworth, started a web hosting business. The current system builds on the old codebase and has undergone significant changes to improve the utility and implement requests from users. The hosting business was sold in 2003 and the author wishes to share his work with others in the open source community. It would be interesting to see if the framework could be implemented in gcj, Mono or c++.