Skip to Content

SAP MII UI5 Application Cache Buster not working

I have not found a clear answer for this issue. UI5 application files are caching and are not updating when the files change on the server. The MII server installed on NetWeaver 7.5 AS Java is not creating the sap-ui-cachebuster-info.json file. Am I missing a step or is my project not structured correctly?

System information:

  • NetWeaver 7.5 AS Java
  • MII 15.1 sp 03 patch 16
  • SAPUI5 on server v1.38.11

On MII server web.xml file:

  • f:\usr\sap\M5D\J00\j2ee\cluster\apps\sap.com\xapps~xmii~ear\servlet_jsp\XMII\root\WEB-INF\web.xml
  • Added
<!-- ============================================================== -->
<!-- AppCacheBuster Filter                                          -->
<!-- ============================================================== -->
<filter>
	<display-name>AppCacheBusterFilter</display-name>
	<filter-name>AppCacheBusterFilter</filter-name>
	<filter-class>com.sap.ui5.resource.AppCacheBusterFilter
</filter-class>
</filter>
<filter-mapping>
	<filter-name>AppCacheBusterFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

In the application Index.irpt:

  • http://<server name>:50000/XMII/CM/coeMES/Index.irpt
  • Component.js and manifest.json are in the same folder as Index.irpt
<script src="/sapui5/resources/sap-ui-cachebuster/sap-ui-core.js"
	id="sap-ui-bootstrap"
	data-sap-ui-compatVersion="edge"
	data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.table,sap.ui.layout"
	data-sap-ui-theme="sap_bluecrystal"
	data-sap-ui-appCachebuster="./">
</script>

The server has been rebooted a few times when trying to troubleshoot this issue. I have found related support articles, but nothing seems to work (most seem to cover UI5 running on NetWeaver AS ABAP).

Enable Filter for JAVA Applications

App Cache Buster - for ABAP Server

MII Related Cache Buster Question - Enable Caching of JS Files

MII Related Cache Buster Question - Not Rebuilding File

webxml.txt (26.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 28, 2017 at 05:19 PM

    I haven't looked at it in a while but I think the cache buster only works for ui5 apps served on the abap stack. The solution I came up with for application resources served from MII is to create a version.json file with something like { "_TheAppVersion": "1.0" } in it that I update every time we make a change or move a project. Then I do something like the code below when I init the app. This works because UI5 loads all of the application resources via ajax. We are basically appending a version number to all ajax call urls globally with the ajax setup. So if the version/url value is the same as what the the browser already has cached it won't go out and download the files again. If the version/url has changed the browser will go get the new files. Note this method only really works for application resources not necessarily the core ui5 library.

    Salvatore Castro and Former Member , is there an official/supported way that you know of to handle this issue re MII?

     sap.ui.getCore().attachInit(function () {
    
                //force update on page load if version changed - i.e. app cache buster
                $.post( "/XMII/CM/TheApp/version.json?"
                    + "&__=" + new Date().getTime()
                    , function(data){
                        $.ajaxSetup({
                            data: {
                                _TheAppVersion: data._TheAppVersion
                            }
                        });
                        var theapp = new sap.ui.core.ComponentContainer({
                            name : "TheApp",
                            height : "100%"
                        });
                        theapp.placeAt("content");
                        return;
                    }
                    , 'json'
                );
            });

    Regards,
    Christian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 24 at 03:24 PM

    I can tell you that Netweaver AS Java 7.5 doesn't support the AppCacheBusterFilter. It is only in the ABAP release.

    We are taking a look at implementing a similar solution for MII in MII 15.1 to better handle caching but it is not released yet.

    Add comment
    10|10000 characters needed characters exceeded