共享 AMP 中的静态 HTML 页面

Static HTML page in a Share AMP

我已经为 Alfresco Share 制作了 AMP

现在,我希望 AMP 在安装后也提供静态 HTML 页面。

最好的方法是什么?

我可以创建一个 Alfresco Share Web Script,但这太过分了,对吧?

这是@vikash推荐的方法,如果您发现更好的方法请post一个新的答案,谢谢!

在您的 Share AMP 中,添加以下 3 个文件:

  • 文件 src/main/amp/config/alfresco/templates/mypage.ftl 仅包含静态页面的 HTML。
  • 文件 src/main/amp/config/alfresco/web-extension/site-data/template-instances/mypage.xml 包含 <template-instance><template-type>mypage</template-type></template-instance>
  • 文件 src/main/amp/config/alfresco/web-extension/site-data/pages/mypage.xml 包含:

<page>
    <template-instance>mypage</template-instance>
    <authentication>none</authentication>
</page>

然后编译并重新部署您的 Share AMP。
该页面应该在 http://localhost:8080/share/page/mypage

可见

在您的源 AMP 包中,创建一个文件夹 src/web-resources/

file-mapping.properties 中有一个条目 /web-resources=/ 例如

/config=/WEB-INF/classes
/web-resources=/

您的 AMP 内容应该类似于:

Archive:  build/dist/Custom500.amp
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2017-04-28 15:28   lib/
      136  2013-07-23 08:50   module.properties
        0  2016-04-01 10:26   web-resources/
    14643  2016-04-01 10:26   web-resources/error500.jsp
     4286  2016-02-03 10:11   web-resources/favicon.ico
       41  2014-08-13 23:37   file-mapping.properties
---------                     -------
    19458                     6 files

安装该 AMP 后,AMP 中 web-resources 文件夹下的文件(之前在 src/web-resources 中)将被放入 Share webapp 的路径中,可以直接提供通过 Tomcat

(此示例是为共享覆盖 favicon 和 500 错误页面,但仅添加自定义网页而不是覆盖内置的网络服务资源几乎相同!)