loading table of contents...

6.3.11. View Repositories

Requirements

A CoreMedia deployment can host multiple sites which frequently differ in layout and functionality. It is a common requirement to use different view templates for those sites but still be able to define reused templates across sites flexibly.

Solution

The CoreMedia CAE offers a very flexible view selection mechanism by providing the ViewRepositoryNameProvider and ViewRepositoryProvider abstraction (see [Content Application Developer Manual], chapter "Views").

CoreMedia Blueprint offers the BlueprintViewRepositoryNameProvider implementation which for each lookup of model and view generates a list of view repository names to query. The list is created based on

  • the specific view repository names defined in the String list setting viewRepositoryNames of the navigation context of the provided model,

  • the view repository names defined via Spring in the property commonViewRepositoryNames on the BlueprintViewRepositoryNameProvider Java bean.

This allows for more fine-grained control of the used view repositories as view repositories can be configured not only specific for a site but also for each site section.

CoreMedia Blueprint uses the standard CAE TemplateViewRepositoryProvider to create from the list of view repository names the list of actual view repositories to query. CoreMedia Blueprint configures the following templateLocationPatterns for the TemplateViewRepositoryProvider:

  • jar:id:contentproperty:/Themes/%1$s/templates/%1$s-templates.jar/archive!/META-INF/resources/WEB-INF/templates/%1$s

  • jar:id:contentproperty:/Themes/%1$s/templates/%1$s-templates.jar/archive!/META-INF/resources/WEB-INF/templates/sites/%1$s

  • /WEB-INF/templates/sites/%s

  • /WEB-INF/templates/%s

Example: For a content of the corporate site the BlueprintViewRepositoryNameProvider yields the view repository names "corporate". The TemplateViewRepositoryProvider would then return the following view repositories which are queried for the responsible view:

  • A FreeMarker template view repository in the CMS located in the /Themes/corporate/templates/corporate-templates.jar (a CMTemplateSet) content item's blob property archive

  • A Freemarker or JSP file system view repository below /WEB-INF/templates/sites/corporate

  • A Freemarker or JSP file system view repository below /WEB-INF/templates/corporate