07-26-2017 05:44 AM
Hi, i have created some surf extension in my "share" project, for my reasons the properties messages for these surf extensions are saved in a properties file messages (myalfresco.messages.properties) under a jar (dependency of a AMP module) file on the "alfresco" web app, the full path to the properties file is like this:
/tomcat/webapps/alfresco/WEB-INF/lib/my-common.jar/uzip://my/properties/myalfresco.messages.properties
There is a way for the share webapp to load/read on the surf extensions doclib context file (e.g. /webapps/share/WEB-INF/classes/alfresco/web-extension/myshare-doclib-contenxt.xml) with the "ResourceBundleBootstrapComponent" these properties with a bean like this?
<bean id="myresources"
class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<!-- This file is not on share but on alfresco =.= -->
<value>my.properties.myalfresco.messages</value>
</list>
</property>
</bean>
Greetings.
07-27-2017 03:52 PM
No, you cannot. The properties file must be contained in the classpath of the Share webapp.
07-27-2017 07:23 AM
The value for the resource bundle should be my.properties.myalfresco.messages since it is based on the classpath location where the file is located in, up to the file name without the file extension or any locale identifier suffixes. I do recommend renaming the file from myalfresco.messages.properties to a name without a dot in it, as the dot has a special meaning (path separator) in resource bundle IDs and there might be issues with looking up a file that contains a dot other than the extension separator.
07-27-2017 01:38 PM
ty Faust you are right ,i write the question from the phone and make some dirt, beside that , the core of the question is "can i use that value to invoke a properties file stored on the alfresco webapp from the share webapp ? " or exists some other way to accomplish that?
Greetings.
07-27-2017 03:52 PM
No, you cannot. The properties file must be contained in the classpath of the Share webapp.
09-08-2017 09:45 AM
Just for help anyone have the same issue even with the Faust comment is still correct these bean seems to work.
<!-- =========================================================== -->
<!-- LOAD EXTERNAL PROPERTIES AND LOAD WITH java.util.Properties -->
<!-- =========================================================== -->
<bean id="configurazioniBeanCompletoLocale" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath*:it/test/properties/alfresco.properties</value>
<value>classpath*:it/test/properties/override-alfresco.properties</value>
</list>
</property>
</bean>
<!-- ======================== -->
<!-- LOAD INTERNAL PROPERTIES -->
<!-- ======================== -->
<!-- Add module specific messages and labels -->
<bean id="webdesktop-share-amp-action.i18n.resources"
class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.web-extension.messages.webdesktop-share-amp-actions-custom</value>
</list>
</property>
</bean>
<!-- ======================== -->
<!-- LOAD EXTERNAL PROPERTIES -->
<!-- ======================== -->
<bean id="configurazioniBeanCompletoLocale" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:it/test/properties/alfresco.properties</value>
<value>classpath*:it/test/properties/override-alfresco.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="searchSystemEnvironment" value="false"/>
<property name="propertiesPersister">
<bean class="org.alfresco.config.AlfrescoPropertiesPersister" />
</property>
</bean>
Explore our Alfresco products with the links below. Use labels to filter content by product module.