Vaadin AbstractJavaScriptComponent: prevent browser javascript caching [duplicate]

瘦欲@ 提交于 2019-12-05 21:26:22

I have overcome this by utilising the resourceCacheTime parameter of the Vaadin servlet configuration:

@VaadinServletConfiguration(ui = MyUI.class, resourceCacheTime = 0)

Please see DefaultDeploymentConfiguration.class with regards to the default values.

Setting this value to 0 adds the following response header:

cache-control: public, max-age=0, must-revalidate

instructing caches to revalidate this resource every time.

com.vaadin.server.communication.PublishedFileHandler.handleRequest is where the published file response is created. The issue here is that this is a global setting for all published resources and so the only way to customise this would be to create your published file handler.

Maybe Vaadin would consider adding another option to the @Javascript/@StyleSheet annotation to achieve a more specific resource cache time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!