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>
Global settings for JMAGE that determine runtime behaviour. All properties are optional. For further details see each property item's description.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
resourcedir | The 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. | no | Relative or absolute directory paths, i.e '/foo' or 'bar' | n/a |
fixPNGonIE | This 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 |
cachedir | If 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. | no | n/a | Relative or absolute directory paths, i.e '/foo' or 'bar' |
ResourceManager handles a set of ResourceFactory implementations in a chain of responsibility. You can also add your own factories here.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
pool | Specifies 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 |
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.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
class | The org.jmage.resource.ResourceFactory implementation.
| Yes | Fully qualified java class names | n/a |
cachesize | Number of resources this factory should cache. | no | [1-n] | 0 |
cachetype | Type of cache persistence. | no | [memory | disk] | n/a |
FilterChainManager handles a set of FilterChainFactory implementations in a chain of responsibility. You can also add your own factories here.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
pool | Specifies 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 |
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.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
class | The org.jmage.filterchain.FilterChainFactory implementation. | Yes | Fully qualified java class names | n/a |
cachesize | Number of filterchains this factory should cache. Note that cached filterchains are not threadsafe | no | [1-n] | 0 |
cachetype | Type of cache persistence. | no | [memory | disk] | n/a |
EncoderManager handles a set of ImageEncoder implementations in a chain of responsibility. You can also add your own encoders here.
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
pool | Specifies 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 |
ImageEncoders are responsible for encoding into a particular binary format. Currently supported are org.jmage.encoder.GifEncoder
and
org.jmage.encoder.DefaultImageEncoder
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
class | Implementations of org.jmage.encoder.ImageEncoder | Yes | Fully qualified java class names | n/a |
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
Property | Description | Required | Allowed Values | Default |
---|---|---|---|---|
class | The org.jmage.dispatcher.RequestDispatcher implementation. | Yes | Fully qualified java class names. | n/a |
pool | Specifies the number of pooled dispatchers. | no | [1-n] | 1 |
cachesize | Number of image requests jmage should cache. | no | [1-n] | 0 |
cachetype | Type of cache persistence. | no | [memory | disk] | n/a |