Xthings

Or how to make an x-rated website

This blog is brought to you courtesy of a custom-written WebObjects application, partially as an excuse to experiment with various technologies that, by a strange coincidence, happened to begin with the letter ‘x’. The code-name for this application was, rather unimaginatively, ‘xthings’.

We’ve written many content management systems using WebObjects — most of them tailored to very specific requirements — but wanted to see whether it would be easy to write a much more generic system that relied on XML to hold the article content, and XSLT to tranform it into XHTML that could be presented.

The following diagram outlines how xthings reponds to requests:

Xthings flow diagram

1Incoming page request…

2…goes to apache. At this stage we check to see if the file already exists on disk, in which case we can return it as with any other static file. If it doesn't already exist, then we go for the dynamic approach: the incoming request is transformed — using apache rewrite rules — and is sent to the xthings application.

3Static files can be returned directly for performance.

4We take the XML content for the appropriate page…

5…along with the XSLT transformation…

6…and apply the transform…

7…to get the resulting (X)HTML file, which we return to the browser, and also save to disk so that the next time the page is requested the static version can be returned.

8The page is displayed and, thanks to some other CSS and JavaScript files, hopefully looks the way it was intended!

Post your own comment here: