Alfresco:当有一个Web Script Extension文件夹时,为什么没有Scripts Extension文件夹?

时间:2014-11-21 13:52:41

标签: alfresco

当我了解网页脚本时,教程说只留下Web Scripts文件夹,而是将我的网页脚本添加到Web Scripts Extensions文件夹。我的理解是,这样我就不会污染Alfresco开箱即用的网页脚本,升级会更容易。

为什么Scripts文件夹没有等效的 extensions 文件夹?

或者我对Web Scripts vs Web Scripts Extensions文件夹错误原因的理解是什么?

2 个答案:

答案 0 :(得分:1)

扩展文件夹提供了一种覆盖默认行为的方法。如果您愿意,可以将代码放在那里,但这样做会使覆盖它更加困难。我将使用存储库作为示例。类似的逻辑适用于分享。

看看alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml。它写着:

   <bean name="webscripts.store.repo.extension" parent="webscripts.repostore">
      <property name="store"><value>workspace://SpacesStore</value></property>
      <property name="path"><value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/cm:extensionwebscripts</value></property>
   </bean>

   <bean name="webscripts.store.repo" parent="webscripts.repostore">
      <property name="mustExist"><value>true</value></property>
      <property name="store"><value>workspace://SpacesStore</value></property>
      <property name="path"><value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/cm:webscripts</value></property>
   </bean>

   <bean id="webscripts.repoclasspathstore" class="org.alfresco.repo.web.scripts.RepoClassPathStore" abstract="true" />

   <bean id="webscripts.store" parent="webscripts.repoclasspathstore">
      <property name="mustExist"><value>false</value></property>
      <property name="classPath"><value>webscripts</value></property>
   </bean>

   <bean id="webscripts.store.alfresco" parent="webscripts.repoclasspathstore">
      <property name="mustExist"><value>false</value></property>
      <property name="classPath"><value>alfresco/webscripts</value></property>
   </bean>

   <bean id="webscripts.store.client" parent="webscripts.repoclasspathstore">
      <property name="mustExist"><value>true</value></property>
      <property name="classPath"><value>alfresco/templates/webscripts</value></property>
   </bean>

   <bean id="webscripts.store.client.extension" parent="webscripts.classpathstore">
      <property name="classPath"><value>alfresco/extension/templates/webscripts</value></property>
   </bean>
   <bean id="webscripts.searchpath" class="org.springframework.extensions.webscripts.SearchPath">
      <property name="searchPath">
          <list>
             <ref bean="webscripts.store.repo.extension" />
             <ref bean="webscripts.store.repo" />
             <ref bean="webscripts.store.client.extension" />
             <ref bean="webscripts.store.client" />
             <ref bean="webscripts.store.alfresco" />
             <ref bean="webscripts.store" />
          </list>
      </property>
   </bean>

searchPath的{​​{1}}属性显示搜索顺序。搜索一旦匹配就会终止。如您所见,只要路径是唯一的,将自定义代码放在非扩展位置就没有问题。

我个人只将覆盖网页脚本放在扩展位置。

答案 1 :(得分:0)

您可以在Scripts下创建名为扩展程序的文件夹,并将所有脚本放入其中。或者只是在Scripts下为每个功能或项目创建不同的文件夹,这并不重要。他们被Alfresco接走了。

相关问题