Murka in russian is a typical name for a female cat so it should work fine with Tomcat. It's also a famous russian/jewish song about... well not quite a cat
What does it do?
Murka creates a convenient apache, xml, xsl based web publishing environment. It manages caching of static html pages and integrates nicely with Tomcat for dynamic pages to provide a flexible, high performance MVC development framework.
How does it work?
Murka is an apache module (mod_murka). It performs XML and XSL processing for both static and dynamic pages.
For static pages it intercepts an http request at a very early stage of apache request processing and if the requested file has .html type performs the following steps:
1. Checks if file exists. If it exists returns control to standard apache request processing.
2. If the file does not exist looks for xml file in the same directory and with the same name (but with .xml extension). For example if the request file had a name test.html the xml file name would be test.xml.
3. Processes the xml file to find the location of the corresponding xsl stylesheet.
4. Calls Xalan XSLT engine with found xml and xsl files as parameters to produce an html file.
5. Saves html file at the requested location (test.html in the sample case).
6. Returns control to apache
Next time when the same html file is requested it would exist as a plain html and no Murka processing would be necessary. The above procedure results in implicit html cache building for all requested html files. If any of the xml data files or presentation stylesheet xsl files changes, one just needs to delete the corresponding html file (clear cache) and Murka would build the updated html file automatically. Also Murka can automatically regenerate html files if xml data has been changed.
For dynamic pages it does a quick XML/XSL transformation of the XML content generated by java application and sends to a browser the resulting HTML page. That makes a full separation of business and presentation logic where java application (business logic) and presentation (XSL) can be developed by different people with practically no overlap and provides a nice alternative to jsps. The major advantage of this approach compared to doing XSL transformations in java is a huge performance gain due to much faster XSLT processing in C.
Dynamic stylesheet linking
One of the most important features of Murka is its ability to make a rule based association of a single xml and xsl file with multiple html files or a single xml file with multiple style sheets and multiple html files. Both scenarios are very common in web development.
The first one occurs when there is some xml data and it should be displayed in a standard way but cached as separate html files for different subsets of xml data. A standard example for a content publishing site would be multi page articles: it is natural to store the text of an article in a single xml file but each page should be cached as a separate html file.
The second scenario is when the same content should be displayed in different styles, for example a page with a printable version of an article.
To deal with both cases Murka uses a single rule: the dash (-) in a file name has a special meaning. If the file name in a URL contains dash Murka adds to steps 2 and 3 from the above list the following additional logic:
1. It takes the part of the file name before '-' and looks for an xml file with that name. If the xml file exists it uses this xml file, otherwise it tries the full name with '-' (so that to support meaningless '-' just as part of the filename).
2. It first looks for a stylesheet the name of which combines the name it finds in the xml file and the second (after '-') part of the file name in the URL. It uses this stylesheet if it finds it, otherwise it uses the "default" stylesheet defined in the xml file.
In both cases the value of the "after-dash" part of the file name is assigned to a special global variable with a name Sys_NamePar that is passed to the stylesheet and can be used there.
All that might sound complicated but it really is not. Murka comes with a fully functional example which shows how it works and explains everything in detail.
Parameters passed to a stylesheet
In addition to Sys_NamePar Murka passes to stylesheet some standard http parameters and assigns the values to the corresponding variables. Below is the full list of parameters
|Sys_NamePar||the special id variable (see above)|
|Sys_PageUrl||the URL of the current page|
|Sys_Host||the server host name|
Integration with Tomcat
Murka integrates well with Tomcat to process XML dynamically generated by a java application. If you don't have a complex data intensive dynamic java applications you can skip this section: Murka would work fine for you by itself. To make Murka work with Tomcat first you would need to install Tomcat. Next install the apache tomcat connector module mod_jk. And finally configure the MURdynmount and MURdyncnt entries in the mod_murka apache config file (see next section). That is it. Now all you need to do in your java servlet is to send your data in xml format to standard output and Murka will do the xsl transformation and send html file to the client.
Murka compiles as a shared object and can be enabled in apache by including the following line into the apache configuration file:
It also supports the following configuration parameters in the httpd.conf:
The sample values could be:
|MURdebug||0 - no debugging, 1 - errors only, 2 - full debugging|
|MURcaching||0 - caching disabled, 1 - caching enabled, 2 - automatically update cached html file if the corresponding xml file was updated|
|MURdynmount||Dynamic pages context. Urls that match this context will be treated as producing XML output.|
|MURdyncnt||Dynamic pages content type. Dynamic pages with the content type defined here will be processed by Murka. If all content types should be processed use * here.|
The latest vestion of Murka is for Apache 2. There is also old version for Apache1.3 but I'm not planning to do any development or bug fixing for it.
Murka 0.8 (for Apache 2)
Murka 0.1 (for Apache 1.3)
1. Download a stable Apache2 release and follow apache installation instructions to install Apache server. (Apache Home Page)
2. Download and install xerces and xalan. (See Xerces Home Page and Xalan Home Page).
3. Download mod_murka (Murka Home Page)
4. Untar mod_murka files into any directory.
5. Modify the top lines in the Murka Makefile to point to your apache, xerces and xalan home directories.
6. Type make install
7. Start apache, go to http://yourhostname to make sure that it is running.
8. Move murkasamplehtml directory from Murka installation directory to apache htdocs root directory (mv $HOME_MURKA/murkasamplehtml $HOME_APACHE/htdocs)
9. Go to http://yourhostname//murkasamplehtml and try the test link. If you can see a confirmation page Murka is installed correctly. Enjoy!
The module was suggested and coded by Alex Esterkin <email@example.com>.
I would like to thank Kevin Newman <firstname.lastname@example.org> and Pan Chan <email@example.com>, who provided invaluable help in testing its first version and discussing its features.