Swith off cache for page

Hi,
I would like to turn off cache for my app.
For regular web app I can do it using meta tags in the HTML header:
< meta http-equiv=“Pragma” content=“no-cache”>
< meta http-equiv=“Cache-Control” content=“no-cache”>

How can I do something like this in cuba app?

Hello,

You can create a spring bean and implement BootsrapListener. It allows you to modify HTML document before the final HTML is generated:

@Component(AppBootstrapListener.NAME)
public class AppBootstrapListener implements BootstrapListener {

    public static final String NAME = "app_AppBootstrapListener";

    @Override
    public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
        // do nothing
    }

    @Override
    public void modifyBootstrapPage(BootstrapPageResponse response) {
        Element head = response.getDocument().getElementsByTag("head").get(0);

        Element meta = response.getDocument().createElement("meta");
        meta.attr("http-equiv", "Pragma");
        meta.attr("content", "no-cache");

        head.appendChild(meta);

        Element meta1 = response.getDocument().createElement("meta");
        meta1.attr("http-equiv", "Cache-Control");
        meta1.attr("content", "no-cache");

        head.appendChild(meta1);
    }
}