StaticFileServer implements StaticFileHandler { protected int getCacheTime(String filenameWithPath) { if (filenameWithPath.contains(".nocache.")) { return 0; } if (filenameWithPath.contains(".cache.")) { return 60 * 60 * 24 * 365; } return 3600; } StaticFileServer(VaadinServletService servletService); @Override boolean isStaticResourceRequest(HttpServletRequest request); @Override boolean serveStaticResource(HttpServletRequest request,
            HttpServletResponse response);  }
@Test public void getCacheTime() { int oneYear = 60 * 60 * 24 * 365; Assert.assertEquals(oneYear, fileServer.getCacheTime("somefile.cache.js")); Assert.assertEquals(oneYear, fileServer.getCacheTime("folder/somefile.cache.js")); Assert.assertEquals(0, fileServer.getCacheTime("somefile.nocache.js")); Assert.assertEquals(0, fileServer.getCacheTime("folder/somefile.nocache.js")); Assert.assertEquals(3600, fileServer.getCacheTime("randomfile.js")); Assert.assertEquals(3600, fileServer.getCacheTime("folder/randomfile.js")); }