Config File

Jmage.xml is the main config file. It determines how the framework will respond to requests for images, allows for cache and performance tuning, and is used to build up a singleton application context at startup time. To find out what individual settings mean, click on one of them in the sample file below.


 <jmage>
    <properties>
        <property name="resourcedir" value="/resource"/>

        <property name="fixPNGonIE" value="true"/>

        <property name="cachedir" value="/cache"/>
    </properties>

    <resourcemanager pool="10">
        <factory class="org.jmage.resource.DefaultImageFactory"
            cachesize="25"
            cachetype="memory"/>
        <factory class="org.jmage.resource.FontFactory"/>
    </resourcemanager>

    <filterchainmanager pool="10">
        <factory class="org.jmage.filterchain.SimpleFilterChainFactory"/>
        <factory class="org.jmage.filterchain.XmlFilterChainFactory"
                    cachesize="1"
                    cachetype="memory"/>
    </filterchainmanager>

    <encodermanager pool="10">
        <factory class="org.jmage.encoder.DefaultImageEncoder"/>
        <factory class="org.jmage.encoder.GifEncoder"/>
    </encodermanager>

    <requestdispatcher class="org.jmage.dispatcher.FilteringRequestDispatcher"
                          pool="10"
                          cachesize="50"
                          cachetype="disk"/>
 </jmage>
          

Items and Values

properties

Global settings for JMAGE that determine runtime behaviour. All properties are optional. For further details see each property item's description.

PropertyDescriptionRequiredAllowed ValuesDefault
resourcedirThe resourcedir parameter specifies an absolute or relative directory on your server file system. If specified relative, it's parent directory will be the directory your appserver starts it's Jvm in. The DefaultImageFactory will try to locate relative resources inside your web application first, if it doesn't find any, it will look in this directory, external to your web application. Specify this parameter if you want to dynamically serve images you haven't included at compile time.noRelative or absolute directory paths, i.e '/foo' or 'bar'n/a
fixPNGonIEThis fixes a rather nasty Microsoft bug in Internet Explorer, versions 5 and 6. PNG transparency is broken in these browsers, so if you try to use any 4 band RGBA PNGs, the alpha channel won't work. This basically breaks blending effects and transparent backgrounds and results in an ugly grey being shown instead. The problem is widely documented, yet Microsoft hasn't fixed it so far. Turn this setting on to use a client side IE hack based on Javascript/ActiveX that fixes this. It will only affect pages with JSP tags, requested from IE.no[true] | [false]false
cachedirIf you specify one or more disk caches for jmage, it will write to the directory specified in this property. Make sure that the location is available to your web application at runtime. non/aRelative or absolute directory paths, i.e '/foo' or 'bar'

resourcemanager

ResourceManager handles a set of ResourceFactory implementations in a chain of responsibility. You can also add your own factories here.

PropertyDescriptionRequiredAllowed ValuesDefault
poolSpecifies the number of pooled resourcefactories. For performance reasons, ResourceFactories are preinstantiated and put into an object pool where the FilteringRequestDispatcher requests them from. no[1-n]1

resourcefactory

ResourceFactories are responsible for supplying a specific kind of resource. They are controlled by the ResourceManager under which they are configured and their results can be automatically cached.

PropertyDescriptionRequiredAllowed ValuesDefault
classThe org.jmage.resource.ResourceFactory implementation. YesFully qualified java class namesn/a
cachesizeNumber of resources this factory should cache.no[1-n]0
cachetypeType of cache persistence.no[memory | disk]n/a

filterchainmanager

FilterChainManager handles a set of FilterChainFactory implementations in a chain of responsibility. You can also add your own factories here.

PropertyDescriptionRequiredAllowed ValuesDefault
poolSpecifies the number of pooled factories. For performance reasons, FilterChainFactories are preinstantiated and put into an object pool where the FilteringRequestDispatcher requests them from. no[1-n]1

filterchainfactory

FilterChainFactories are responsible for creating single filters or whole filterchains. Currently supported are the org.jmage.filterchain.SimpleFilterChainFactory and the org.jmage.filterchain.XmlFilterChainFactory which reads filterchain configurations from xml format.

PropertyDescriptionRequiredAllowed ValuesDefault
classThe org.jmage.filterchain.FilterChainFactory implementation.YesFully qualified java class namesn/a
cachesizeNumber of filterchains this factory should cache. Note that cached filterchains are not threadsafeno[1-n]0
cachetypeType of cache persistence.no[memory | disk]n/a

encodermanager

EncoderManager handles a set of ImageEncoder implementations in a chain of responsibility. You can also add your own encoders here.

PropertyDescriptionRequiredAllowed ValuesDefault
poolSpecifies the number of pooled encoders. For performance reasons, ImageEncoders are preinstantiated and put into an object pool where the FilteringRequestDispatcher requests them from. no[1-n]1

imageencoder

ImageEncoders are responsible for encoding into a particular binary format. Currently supported are org.jmage.encoder.GifEncoder and org.jmage.encoder.DefaultImageEncoder

PropertyDescriptionRequiredAllowed ValuesDefault
classImplementations of org.jmage.encoder.ImageEncoderYesFully qualified java class namesn/a

requestdispatcher

Requestdispatcher decides on a strategy by which your request for an image will be handled. The only implementation currently supported is org.jmage.dispatcher.FilteringRequestDispatcher

PropertyDescriptionRequiredAllowed ValuesDefault
classThe org.jmage.dispatcher.RequestDispatcher implementation.YesFully qualified java class names.n/a
poolSpecifies the number of pooled dispatchers. no[1-n]1
cachesizeNumber of image requests jmage should cache.no[1-n]0
cachetypeType of cache persistence.no[memory | disk]n/a