About this Guide

This User Guide is intended to help those who want to integrate MadCaching into their new or existing project.

Downloading MadCaching

If you have not already done so, download a distibution MadCaching file. And unzip or untar in a temporary directory.

MadCaching distribution directory structure

You should have the following directory structure after unzip or untar the distribution file.

madcaching-0.5/
    lib/               <--- Contains the madcaching-0.5.jar file required to enable madcaching.
    webapp/            <--- Configuration files and sample required to enable madcaching.
    LICENSE.txt        <--- The License for MadCaching.

Quick Start Guide

This is a Quick Start Guide for new and existing Struts and Tiles project. If you starting a new project, copy a blank project from Struts.

Copy webapp files

Copy all the files in the webapp directory to your project web application.

Configure web.xml

Edit the web.xml file with your favorite editor. In the servlet section add the following init-param.

    <init-param>
        <param-name>config/madcaching</param-name>
        <param-value>/WEB-INF/madcaching-config.xml</param-value>
    </init-param>

Change the struts-tiles taglib to point to struts-cachetiles.tld.

    <taglib>
        <taglib-uri>/struts-tiles</taglib-uri>
        <taglib-location>/WEB-INF/struts-cachetiles.tld</taglib-location>
    </taglib>

Configure struts-config.xml

Edit the struts-config.xml file with your favorite editor. Modify the controller to the following.

    <controller processorClass="com.macvu.tiles.CacheTilesRequestProcessor"/>

Change the TilesPlugin configuration to the following:

<plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-factory-class" value="com.macvu.tiles.xmlDefinition.CacheI18nFactorySet"/>
    <set-property property="definitions-config"
        value="/WEB-INF/tiles-defs.xml"/>
    <set-property property="definitions-parser-validate" value="false"/>
</plug-in>

You can add an action forward to madcaching manager.

<action path="/madcaching"
            forward="/madcaching/cacheTileManager.jsp"/>

Note on security

You should add security configuration to only allow administrator to access the madcaching path.