private CacheControl parseCacheControl(Element element) { CacheControl cacheControl; if ("true".equals(element.getAttribute("no-cache"))) { cacheControl = CacheControl.noCache();
private CacheControl parseCacheControl(Element element) { CacheControl cacheControl; if ("true".equals(element.getAttribute("no-cache"))) { cacheControl = CacheControl.noCache();
@Test public void noCachePrivate() throws Exception { CacheControl cc = CacheControl.noCache().cachePrivate(); assertThat(cc.getHeaderValue(), Matchers.equalTo("no-cache, private")); }
@Test public void cacheControl() { assertThat(getHandler("/resources/**").getCacheControl(), Matchers.nullValue()); this.registration.setCacheControl(CacheControl.noCache().cachePrivate()); assertThat(getHandler("/resources/**").getCacheControl().getHeaderValue(), Matchers.equalTo(CacheControl.noCache().cachePrivate().getHeaderValue())); }
@Test public void cacheControl() { assertThat(getHandler("/resources/**").getCacheControl(), Matchers.nullValue()); this.registration.setCacheControl(CacheControl.noCache().cachePrivate()); assertThat(getHandler("/resources/**").getCacheControl().getHeaderValue(), Matchers.equalTo(CacheControl.noCache().cachePrivate().getHeaderValue())); }
cControl = (this.useCacheControlNoStore ? CacheControl.noStore() : CacheControl.noCache());
@Test public void cacheControlBuilder() { headers.setCacheControl(CacheControl.noCache()); assertEquals("Invalid Cache-Control header", "no-cache", headers.getCacheControl()); assertEquals("Invalid Cache-Control header", "no-cache", headers.getFirst("cache-control")); }
@Test public void cacheControlTag() { Mono<ServerResponse> result = ServerResponse.ok().cacheControl(CacheControl.noCache()).build(); StepVerifier.create(result) .expectNextMatches(response -> "no-cache".equals(response.headers().getCacheControl())) .expectComplete() .verify(); }
@Test public void cacheControlTag() { String body = "foo"; Mono<EntityResponse<String>> result = EntityResponse.fromObject(body).cacheControl(CacheControl.noCache()).build(); StepVerifier.create(result) .expectNextMatches(response -> "no-cache".equals(response.headers().getCacheControl())) .expectComplete() .verify(); }
cControl = (this.useCacheControlNoStore ? CacheControl.noStore() : CacheControl.noCache());
public HttpHeadersBuilder withNoCache() { this.headers.set( HttpHeaders.CACHE_CONTROL, CacheControl.noCache().getHeaderValue() ); return this; }
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { String[] locations = new String[]{"classpath:/static/"}; if (NzbHydra.getDataFolder() != null) { File staticFolderFile = new File(new File(NzbHydra.getDataFolder()).getParentFile(), "static"); try { String fileStatic = staticFolderFile.toURI().toURL().toString(); locations = (fileStatic != null && staticFolderFile.exists()) ? new String[]{fileStatic, "classpath:/static/"} : new String[]{"classpath:/static/"}; logger.info("Found folder {}. Will load UI resources from there", staticFolderFile.getAbsolutePath()); } catch (MalformedURLException e) { logger.error("Unable to build path for local static files"); } } registry.addResourceHandler("/static/**") .addResourceLocations(locations) .setCacheControl(CacheControl.noCache()) .resourceChain(false); registry.setOrder(0); }
private CacheControl parseCacheControl(Element element) { CacheControl cacheControl; if ("true".equals(element.getAttribute("no-cache"))) { cacheControl = CacheControl.noCache();
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**") .addResourceLocations("classpath:/static/") .setCacheControl(CacheControl.noCache()) .resourceChain(false) //.addResolver(new VersionResourceResolver().addContentVersionStrategy("/static/js/**", "/static/css/**")) ; registry.setOrder(0); }
cControl = (this.useCacheControlNoStore ? CacheControl.noStore() : CacheControl.noCache());