Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Servlet init params

Chuck Dumont edited this page Jun 25, 2015 · 43 revisions

Servlet specific options may be specified using servlet init-params in the plugin.xml used to define the servlet as in the following example:

<extension point="org.eclipse.equinox.http.registry.servlets">
    <servlet alias="/testaggr" class="com.ibm.jaggr.service.impl.AggregatorImpl">
        <init-param name="config" value="testaggr-config.js"/>
    </servlet>
</extension>

Substitution variables of the form ${propertyname} may be used in init-param value strings. The substitution variables will be resolved using Java system properties, and/or any services implementing the [com.ibm.jaggr.service.IVariableResolver](http://openntf.github.io/JavascriptAggregator/jaggr-core/apidocs/index.html?com/ibm/jaggr/core/IVariableResolver.html) interface that have been registered for the Aggregator. If the named property cannot be resolved, then the value string is not modified.

The Aggregator supports the following servlet init-params:

Name Description
config This init-param is required and has no default value.  It specifies the name of the [server-side AMD config](The-Server-side-AMD-config) file.
modulebuilders Specifies the id of an extension implementing the [`com.ibm.jaggr.service.modulebuilder`](Extensibility#comibmjaggrservicemodulebuilder) extension point that is used by the application.  More than one `modulebuilders` init-param may be specified.  If none are specified, then the `default.modulebuilders` extension defined in the Aggregator's [plugin.xml](../blob/master/jaggr-service/plugin.xml) is used.
resourcefactories Specifies the id of an extension implementing the [`com.ibm.jaggr.service.resourcefactory`](Extensibility#comibmjaggrserviceresourcefactory) extension point that is used by the application.  More than one `resourcefactories` extension may be specified.  If none are specified, then the `default.modulebilders` extension defined in the Aggregator's [plugin.xml](../blob/master/jaggr-service/plugin.xml) is used. 
resourceconverters Specifies the id of an extension implementing the [`com.ibm.jaggr.service.resourceconverter`](Extensibility#comibmjaggrserviceresourceconverter) extension point that is used by the application.  More than one `resourceconverters` extension may be specified.
serviceproviders Specifies the id of an extension implementing the [`com.ibm.jaggr.service.serviceprovider`](Extensibility#comibmjaggrserviceserviceprovider) extension point that is used by the application.  More than one `serviceproviders` extension may be specified. 
httptransport Specifies the id of an extension implementing the [`com.ibm.jaggr.service.httptransport`](Extensibility#comibmjaggrservicehttptransport) extension point that is used by the application.  If not specified, the `dojo.httptransport` extension defined in the Aggregator's [plugin.xml](../blob/master/jaggr-service/plugin.xml) is used. 
maxlayercachecapacity_mb

Specifies the maximum layer cache capacity in mega-bytes of on-disk storage space. The default value is 500.

This parameter is intended to guard against possible DOS attacks which might attempt to consume all available disk space on the server by methodically sending requests for layers with arbitrary combinations of modules. By specifying an upper limit on the size of the cache, the worst effects of this type of attack (running the server out of disk space) can be avoided. The Aggregator uses a LRU algorithm for evicting cache entries when the maximum capacity is reached.

options Specifies the filename of the properties file containing Aggregator options. If not specified, the default options file is aggregator.properties in the home directory of the user that launched the server.
alias Defines an alias for the aggregator servlet, relative to the root of the aggregator servlet as specified by the alias attribute of the servlet definition. For example, if the servlet alias is /jaggr and the servlet definition contains an init-param with a name of alias and a value of /aliased/jaggr, then the aggregator servlet will respond to URLs with the paths /jaggr and /jaggr/aliased/jaggr.

This init-param is new in version 1.2

resource-id

Defines a resource identifier name, which is used to define resource paths relative to the aggregator servlet as specified by the alias attribute of the servlet definition. Resource paths are defined by specifying resource-id:alias and resource-id:base-name init params for resource paths within the aggregator namespace. See the sample application's [plugin.xml](../blob/master/jaggr-sample/plugin.xml) for examples of this usage. Resource paths are used to define the paths to non-aggregated resources within the aggregator's URL namespace, and can be used in conjunction with the [`alias`](#user-content-alias) init-param to define the aggregator and resource paths used by the application in cases where it is convenient to have the aggregator serve both the aggregated and non-aggregated resources for the application.

Note that content-type mappings may be provided for resources served by the aggregator by providing a `mime.types` file in the META-INF directory of the bundle that is instantiating the servlet. The format of this file is defined [here](http://docs.oracle.com/javase/7/docs/api/javax/activation/MimetypesFileTypeMap.html)

This init-param is new in version 1.2.