cancel
Showing results for 
Search instead for 
Did you mean: 

cache-buster mechanism on mobile - how to enable caching of app JS files

Former Member
0 Kudos

I have enabled the cache-buster mechanism and found that it seems to be working for most of the sap resources and the application resources (images, data files).

However testing with the desktop chrome profiling tools tell me that the specific application JS files (views, controllers) are not being cached by the browser. I assume that this is also the case when I run on a mobile device.

So I need to find out if there is something more I need to do to enable the application JS files to become cached locally on the mobile device as well as all the SAP resources. Does the 1.16 version update provide anything extra on the cache buster mechanism (I have been working with 1.14)?

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member201620
Participant
0 Kudos

I do have a web.xml file in my WEB-INF folder and my local tomcat totally agrees on using it It does exactly what I expect. Only on MII it appears like my web.xml is not picked up at all. Are there special conventions (e.g. path to put the web.xml) or configuration options differing from Java Standards in the SAP World?

jmoors
Active Contributor
0 Kudos

What version of NetWeaver are you running and how are you deploying? Do you see any errors in the logs. I expect the issue is that it can't resolve the library containing the ResourceServlet on the portal server.

I seem to remember that we had to add the library reference ui~five in the application-j2ee-engine.xml

<?xml version="1.0" encoding="UTF-8"?>

<application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">

<reference reference-type="hard">

<reference-target target-type="application" provider-name="sap.com">ui~five</reference-target>

</reference>

</application-j2ee-engine>

http://scn.sap.com/community/bpm/blog/2013/01/14/developing-sap-ui5-applications-in-sap-netweaver-de...

Regards,

Jason

former_member201620
Participant
0 Kudos

Hi Jason,

our applications are running inside of MII which itself is a Web Module

The ui~five Web Module is deployed separately under the absolute path /sapui5 and has the ResourceServlet up and running. Our Applications reference it like this:

<script id="sap-ui-bootstrap"
    src="/sapui5/resources/sap-ui-cachebuster/sap-ui-core.js"
    data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-libs="sap.m"
    data-sap-ui-appCacheBuster="./"
   </script>

So if I understood correctly I would have to deploy the UI5 applications as separate Web Modules referencing Web Module ui~five? Is that what you are saying. I'm really confused

BR

Chris

jmoors
Active Contributor
0 Kudos

Hi Chris,

The ui~five web model ResourceServlet will handle any requests to /sapui5/xxx, however your application will be handled by a different url (web model), therefore you need to configure the application web.xml to use the ResourceServlet.

The application web model doesn't include the ResourceSevlet class, so you need to provide the reference to the jar file so it can be loaded.

Regards,

Jason

Former Member
0 Kudos

Hi Jeremy,

I am trying to use the cache-buster mechanism too and while it seems to work when I test in Chrome, I am not convinced that it works on a mobile device (I am using iOS 7) - it still seems to take a very long time to start the app on the mobile device so I don't think the cache is working...

Did you see an improvement in performance on you mobile device?

Thanks,

Simon

p.s. Sorry I can't help with you actual question!

jmoors
Active Contributor
0 Kudos

Hi Simon,

I'm not sure these settings will improve performance, might make it slightly worse if files change and need to be downloaded.

The mechanism ensures that any changes to the javascripts are downloaded by changing the url, to prevent the browser cache relying on the expires time and caching the old version.

Have you checked in chrome that the header variables expires, cache-control etc are being passed?

I think you can also check the sap-ui-cachebuster-info.json file to what timestamps are being used for each of the application files.

You also need to ensure the AppCacheBusterFilter is configured in the web.xml, this was something that I missed.

Thanks,

Jason

jmoors
Active Contributor
0 Kudos

Have you tried the Application cache buster? Looking at the documentation it can be enabled via the configuration option sap-ui-appcachebuster

https://sapui5.hana.ondemand.com/sdk/docs/guide/CacheBuster.html

Former Member
0 Kudos

Thanks for the prompt to recheck the doc one more time, seems that I havent tried enabling everything described there yet, will try further experiments.

former_member201620
Participant
0 Kudos

Hi Jason,

it seems like you have some experience with App Cache Buster. I successfully configured it in my local Eclipse/Tomcat setup but I can't manage to get it work on the Java Stack (particularly SAP MII). You have any experience with AppCacheBuster on Netweaver Java?

BR

Chris

jmoors
Active Contributor
0 Kudos

I've installed on a Java stack, but not MII specifically.

Have you defined a web.xml file for your project, the application files need to be handled by the ResourceServlet which implements the cache mechanism.

http://help.sap.com/saphelp_nw74/helpdata/en/91/f2b4d66f4d1014b6dd926db0e91070/content.htm?frameset=...

Many thanks,

Jason