/** * Set value for max age in caching headers * @param maxAgeSeconds maximum time for browser to cache, in seconds * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.StaticHandler setMaxAgeSeconds(long maxAgeSeconds) { delegate.setMaxAgeSeconds(maxAgeSeconds); return this; }
/** * Set value for max age in caching headers * @param maxAgeSeconds maximum time for browser to cache, in seconds * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.handler.StaticHandler setMaxAgeSeconds(long maxAgeSeconds) { delegate.setMaxAgeSeconds(maxAgeSeconds); return this; }
@Test public void testSetMaxAge() throws Exception { long maxAge = 60 * 60; stat.setMaxAgeSeconds(maxAge); testRequest(HttpMethod.GET, "/otherpage.html", null, res -> { String cacheControl = res.headers().get("cache-control"); assertEquals("public, max-age=" + maxAge, cacheControl); }, 200, "OK", "<html><body>Other page</body></html>"); }
@Test public void testSetMaxAge() throws Exception { long maxAge = 60 * 60; stat.setMaxAgeSeconds(maxAge); testRequest(HttpMethod.GET, "/otherpage.html", null, res -> { String cacheControl = res.headers().get("cache-control"); assertEquals("public, max-age=" + maxAge, cacheControl); }, 200, "OK", "<html><body>Other page</body></html>"); }