Web Client Configuration Guide

From AlfrescoWiki

Jump to: navigation, search

Back to Developer Guide or Server Administration Guide

Contents

[edit] Introduction

From version 1.2 of the repository, the system configuration has been designed to be extensible and overridable. This page gives details of how to override the client configuration without modifying any of the configuration files that are deployed by the Alfresco application.

WARNING: Modifying Alfresco-maintained configuration files is not advisable, as any future alfresco releases will overwrite the changes. Use extensibility options described in this article.

[edit] Alfresco-Maintained Configuration Files

The Alfresco-maintained configuration files now reside inside the alfresco.war file in WEB-INF/classes. They can be viewed in the locations below once the server has started.

JBoss: <JBOSS_HOME>/server/default/tmp/deploy/tmp*alfresco-exp.war/WEB-INF/classes

Tomcat: <TOMCAT_HOME>/webapps/alfresco/WEB-INF/classes

You can use these to review what options are available for configuration. Alternatively, refer to the Web Client Customisation Guide to see how some of the more common configuration options are now applied.


[edit] Location of Extension Configuration Files

Alfresco looks for a file called web-client-config-custom.xml on the classpath in the alfresco.extension package. If you downloaded one of the bundles you will find a sample file in the location below. Simply rename it for it to take effect.

JBoss: <alfresco>/jboss/server/default/conf/alfresco/extension

Tomcat: <alfresco>/tomcat/shared/classes/alfresco/extension

If you are using JBoss that has had a previous version of Alfresco installed ensure your <jboss>/server/default/conf/alfresco folder only contains the extension sub folder, which in turn should only contain your custom files.

[edit] Overriding Configuration

Web client config files can contain configuration that either augments the standard configuration or replaces it.

Replacement is performed at the config section level by adding a replace="true" attribute to the config element, for example:

   <config evaluator="xx" condition="yy" replace="true">

Any configuration found within a section marked this way will replace any configuration found in the Alfresco-maintained files. For example add the following to replace the list of languages shown in the login page:

   <config evaluator="string-compare" condition="Languages" replace="true">
      <languages>
         <language locale="fr_FR">French</language>
         <language locale="de_DE">German</language>
      </languages>
   </config>

[edit] Extending Configuration

On the other hand if you just wanted to add French to the list of languages you would add the following:

   <config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="fr_FR">French</language>
      </languages>
   </config>

[edit] Examples

There are a number of examples showing configuration and customisation options in the Web Client Customisation Guide.

[edit] Configure Additional Config Files

If you need to add more custom files you can override the spring bean that defines the config source the web client uses. Any spring config files ending -context.xml found in the alfresco.extension package is automatically read by Alfresco. The webClientConfigSource spring bean in alfresco/web-client-application-context.xml can be overridden (examples shown below) to list the files you wish to be included.

For example, for Alfresco 2.0 to 2.2

   <bean id="webClientConfigSource" class="org.alfresco.config.source.UrlConfigSource">
      <constructor-arg>
         <list>
            <value>classpath:alfresco/web-client-config.xml</value>
            <value>classpath:alfresco/web-client-config-dialogs.xml</value>
            <value>classpath:alfresco/web-client-config-wizards.xml</value>
            <value>classpath:alfresco/web-client-config-properties.xml</value>
            <value>classpath:alfresco/web-client-config-navigation.xml</value>
            <value>classpath:alfresco/web-client-config-wcm.xml</value>
            <value>classpath:alfresco/web-client-config-actions.xml</value>
            <value>classpath:alfresco/web-client-config-forum-actions.xml</value>
            <value>classpath:alfresco/web-client-config-wcm-actions.xml</value>
            <value>classpath:alfresco/web-client-config-workflow-actions.xml</value>
            <value>classpath:alfresco/extension/your-web-config-file.xml</value>
            <value>file:c:\alfresco\your-other-web-config-file.xml</value>
         </list>
      </constructor-arg>
   </bean>

For example, for Alfresco 2.9 using Dynamic Web Client Config

   <bean id="webClientConfigSource" class="org.alfresco.repo.config.source.RepoUrlConfigSource">
      <constructor-arg>
         <list>
            <value>classpath:alfresco/web-client-config.xml</value>
            <value>classpath:alfresco/web-client-config-dialogs.xml</value>
            <value>classpath:alfresco/web-client-config-wizards.xml</value>
            <value>classpath:alfresco/web-client-config-properties.xml</value>
            <value>classpath:alfresco/web-client-config-navigation.xml</value>
            <value>classpath:alfresco/web-client-config-wcm.xml</value>
            <value>classpath:alfresco/web-client-config-actions.xml</value>
            <value>classpath:alfresco/web-client-config-forum-actions.xml</value>
            <value>classpath:alfresco/web-client-config-wcm-actions.xml</value>
            <value>classpath:alfresco/web-client-config-workflow-actions.xml</value>
            <value>classpath:alfresco/web-client-config-project-actions.xml</value>
            <value>classpath:alfresco/extension/web-client-config-custom.xml</value>
            <value>jar:*!/META-INF/web-client-config-custom.xml</value>
            
            <!-- note: will be skipped if not present -->
            <value>workspace://SpacesStore/${spaces.company_home.childname}/${spaces.dictionary.childname}/app:webclient_extension/cm:your-web-config-file.xml</value>
            <value>workspace://SpacesStore/${spaces.company_home.childname}/${spaces.dictionary.childname}/app:webclient_extension/cm:your-other-web-config-file.xml</value>
         </list>
      </constructor-arg>
      
      <property name="tenantService" ref="tenantService"/>
      <property name="searchService" ref="SearchService"/>
      <property name="contentService" ref="ContentService"/>
      <property name="namespaceService" ref="NamespaceService"/>
      <property name="nodeService" ref="NodeService"/>
    
   </bean>

[edit] Packaging

For the packaging and deployment options you have for your extensions please refer to Packaging And Deploying Extensions.