Content Application Developer Manual / Version 2310
Table Of Contents
Templates can be loaded by the TemplateViewRepositoryProvider
from a blob
property in the content repository instead of a folder in the file system. This may be useful
if for example a small campaign site should be launched or a template needs patching but there
isn't time to redeploy all CAEs.
Caution
This feature only works with FreeMarker templates. In addition, the property delivery.local-resources
must be set to "false".
In order to store templates in the content repository, sets of templates must be put into a
JAR container. The templates in the JAR must have the same directory structure as if the
templates were located in the file system, for example
templates.jar/com.company/Base.ftl
but may be stored in an arbitrary subfolder if
the path is specified in the pattern as described below. The JAR can then be uploaded to an
arbitrary content type with a blob property.
A specially formatted value for the properties templateLocations
or
templateLocationPatterns
must be used. The value must start with the prefix
"jar:id:contentproperty:", add the absolute path to the content containing the templates JAR
(ending with the name of the property), and add "!/" to separate the content path from the
path within the JAR.
For instance, to use a JAR in the "data" blob property of content
"/Sites/templates/<repository name>" as the base for a view repository, set the
following format string: jar:id:contentproperty:/Sites/templates/%s/data!/
.
<customize:replace id="customizeTemplateLocationPatterns" bean="templateLocationPatterns"> <list> <value>jar:id:contentproperty:/path/to/document/%s/blobPropertyName!/</value> </list> </customize:replace>
Caution
It is recommended to use a dedicated content type for storing the template JAR. The content type(s) may be added
to the list of viewLookupTypeTriggers
provided in classpath:/com/coremedia/cae/view-services.xml
.
The CAE will automatically invalidate internal view caches when a content item of one of the types is added, modified, or a property
is changed. (On live servers, publication and deletion of such a content item leads to the cache invalidation)