Velocity Template Loader

Note: this component has a complexity level of "expert", which means that objects of this type are not expected to be created or altered. Please contact support for assistance if you believe that you have a need to create or modify this type of object.

Velocity Template Loaders load templates from the filesystem.

A Velocity Template Loader declares via its mime-type-matcher property the type of content for which it will load templates. When a request is received, an ordered list of preferred media types according to the Accept header is created. Then for each preferred content-type, the set of defined loaders are considered in order according to the value of the evaluation-order-index property. A Velocity Template Loader is configured with a file suffix that is used by the loader to indicate whether or not it has access to a template that can be used to satisfy the request. For example, if a Velocity Template Loader is defined for the "text/html" MIME type with a template suffix of ".html.vm", for a request for the 'login' view, the template file name loaded will be "login.html.vm".

Relations to This Component Properties dsconfig Usage

Relations to This Component

The following components have a direct composition relation to Velocity Template Loaders:

Properties

The properties supported by this managed object are as follows:


Basic Properties: Advanced Properties:
 enabled  None
 evaluation-order-index
 mime-type-matcher
 mime-type
 template-suffix
 template-directory

Basic Properties

enabled

Description
Indicates whether this Velocity Template Loader is enabled. If set to 'false' this loader will not be considered when evaluating loaders to service a request.
Default Value
true
Allowed Values
true
false
Multi-Valued
No
Required
No
Admin Action Required
None. Modification requires no further action

evaluation-order-index

Description
This property determines the evaluation order for determining the correct Velocity Template Loader to load a template for generating content for a particular request. Values of this property must be unique but not necessarily contiguous, and mappings with a smaller value will be evaluated first to determine if they match the requested criteria.

In general you should specify loaders with more specific MIME types with smaller numbers and catch-all loaders that use wildcard mime-types with the higher evaluation order index values.

Default Value
9999
Allowed Values
An integer value. Lower limit is 0.
Multi-Valued
No
Required
Yes
Admin Action Required
None. Modification requires no further action

mime-type-matcher

Description
Specifies a media type for matching Accept request-header values. This property describes a media type that will be used to match Accept request-header values to determine if this loader will be used to load a corresponding template file. Loaders are considered in order by evaluation index for each value in the Accept request-header. Accept request-header values are considered from most desirable to least desirable. Common media types are 'text/html', 'application/xml', and 'application/json'.

Wildcards types and subtypes may be specified using the asterisk '*' character. For example 'text/*' would match both 'text/html' and 'text/xml'.

Value must be unique among other Velocity Template Loaders.

Default Value
None
Allowed Values
The value must represent a valid Internet media type consisting of a type, subtype, and optional parameters.
Multi-Valued
No
Required
Yes
Admin Action Required
None. Modification requires no further action

mime-type

Description
Specifies a the value that will be used in the response's Content-Type header that indicates the type of content to return. This property may be omitted in which case the value of the parent servlet extension's default-mime-type will be used. This property describes a media type that is returned by templates handled by this loader. Common media types are 'text/html', 'application/xml', and 'application/json'.
Default Value
The value of the parent servlet extension's default-mime-type will be used.
Allowed Values
The value must represent a valid Internet media type consisting of a type, subtype, and optional parameters.
Multi-Valued
No
Required
No
Admin Action Required
None. Modification requires no further action

template-suffix

Description
Specifies the suffix to append to the requested resource name when searching for the template file with which to form a response.
Default Value
None
Allowed Values
A string
Multi-Valued
No
Required
No
Admin Action Required
None. Modification requires no further action

template-directory

Description
Specifies the directory in which to search for the template files.
Default Value
This loader will inherit the default template directory from the servlet extension.
Allowed Values
A filesystem path
Multi-Valued
No
Required
No
Admin Action Required
None. Modification requires no further action


dsconfig Usage

To list the configured Velocity Template Loaders:

dsconfig list-velocity-template-loaders
     [--property {propertyName}] ...

To view the configuration for an existing Velocity Template Loader:

dsconfig get-velocity-template-loader-prop
     --loader-name {name}
     --extension-name {name}
     [--tab-delimited]
     [--script-friendly]
     [--property {propertyName}] ...

To update the configuration for an existing Velocity Template Loader:

dsconfig set-velocity-template-loader-prop
     --loader-name {name}
     --extension-name {name}
     (--set|--add|--remove) {propertyName}:{propertyValue}
     [(--set|--add|--remove) {propertyName}:{propertyValue}] ...

To create a new Velocity Template Loader:

dsconfig create-velocity-template-loader
     --loader-name {name}
     --extension-name {name}
     --set mime-type-matcher:{propertyValue}
     [--set {propertyName}:{propertyValue}] ...

To delete an existing Velocity Template Loader:

dsconfig delete-velocity-template-loader
     --loader-name {name}
     --extension-name {name}