Search code examples
alfresco

Static HTML page in a Share AMP


I have made an AMP for Alfresco Share.

Now, I want that AMP to also serve a static HTML page when installed.

What is the best way to do that?

I could create an Alfresco Share Web Script, but that would be overkill, right?


Solution

  • In your source AMP package, create a folder src/web-resources/

    In the file-mapping.properties have an entry for /web-resources=/ eg

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

    Your AMP's contents should then be something like:

    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
    

    When that AMP is installed, the files under the web-resources folder from the AMP (which were in src/web-resources before) will be dropped into the route of the Share webapp and can be served directly by Tomcat

    (This example is to override the favicon and 500 error page for Share, but it's much the same for just adding custom web pages instead of overriding built-in web-served resources!)