/** * Add a "no-store" directive. * <p>This directive is well suited for preventing caches (browsers and proxies) * to cache the content of responses. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a> */ public static CacheControl noStore() { CacheControl cc = new CacheControl(); cc.noStore = true; return cc; }
/** * Return an empty directive. * <p>This is well suited for using other optional directives without "max-age", * "no-cache" or "no-store". * @return {@code this}, to facilitate method chaining */ public static CacheControl empty() { return new CacheControl(); }
/** * Add a "no-cache" directive. * <p>This directive is well suited for telling caches that the response * can be reused only if the client revalidates it with the server. * This directive won't disable cache altogether and may result with clients * sending conditional requests (with "ETag", "If-Modified-Since" headers) * and the server responding with "304 - Not Modified" status. * <p>In order to disable caching and minimize requests/responses exchanges, * the {@link #noStore()} directive should be used instead of {@code #noCache()}. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a> */ public static CacheControl noCache() { CacheControl cc = new CacheControl(); cc.noCache = true; return cc; }
/** * Add a "no-store" directive. * <p>This directive is well suited for preventing caches (browsers and proxies) * to cache the content of responses. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a> */ public static CacheControl noStore() { CacheControl cc = new CacheControl(); cc.noStore = true; return cc; }
/** * Return an empty directive. * <p>This is well suited for using other optional directives without "max-age", * "no-cache" or "no-store". * @return {@code this}, to facilitate method chaining */ public static CacheControl empty() { return new CacheControl(); }
/** * Add a "max-age=" directive. * <p>This directive is well suited for publicly caching resources, knowing that * they won't change within the configured amount of time. Additional directives * can be also used, in case resources shouldn't be cached ({@link #cachePrivate()}) * or transformed ({@link #noTransform()}) by shared caches. * <p>In order to prevent caches to reuse the cached response even when it has * become stale (i.e. the "max-age" delay is passed), the "must-revalidate" * directive should be set ({@link #mustRevalidate()} * @param maxAge the maximum time the response should be cached * @param unit the time unit of the {@code maxAge} argument * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a> */ public static CacheControl maxAge(long maxAge, TimeUnit unit) { CacheControl cc = new CacheControl(); cc.maxAge = unit.toSeconds(maxAge); return cc; }
/** * Add a "no-cache" directive. * <p>This directive is well suited for telling caches that the response * can be reused only if the client revalidates it with the server. * This directive won't disable cache altogether and may result with clients * sending conditional requests (with "ETag", "If-Modified-Since" headers) * and the server responding with "304 - Not Modified" status. * <p>In order to disable caching and minimize requests/responses exchanges, * the {@link #noStore()} directive should be used instead of {@code #noCache()}. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a> */ public static CacheControl noCache() { CacheControl cc = new CacheControl(); cc.noCache = true; return cc; }
/** * Add a "max-age=" directive. * <p>This directive is well suited for publicly caching resources, knowing that * they won't change within the configured amount of time. Additional directives * can be also used, in case resources shouldn't be cached ({@link #cachePrivate()}) * or transformed ({@link #noTransform()}) by shared caches. * <p>In order to prevent caches to reuse the cached response even when it has * become stale (i.e. the "max-age" delay is passed), the "must-revalidate" * directive should be set ({@link #mustRevalidate()} * @param maxAge the maximum time the response should be cached * @param unit the time unit of the {@code maxAge} argument * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a> */ public static CacheControl maxAge(long maxAge, TimeUnit unit) { CacheControl cc = new CacheControl(); cc.maxAge = unit.toSeconds(maxAge); return cc; }
/** * Return an empty directive. * <p>This is well suited for using other optional directives without "max-age", * "no-cache" or "no-store". * @return {@code this}, to facilitate method chaining */ public static CacheControl empty() { return new CacheControl(); }
/** * Return an empty directive. * <p>This is well suited for using other optional directives without "max-age", * "no-cache" or "no-store". * @return {@code this}, to facilitate method chaining */ public static CacheControl empty() { return new CacheControl(); }
/** * Add a "no-store" directive. * <p>This directive is well suited for preventing caches (browsers and proxies) * to cache the content of responses. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a> */ public static CacheControl noStore() { CacheControl cc = new CacheControl(); cc.noStore = true; return cc; }
/** * Add a "no-store" directive. * <p>This directive is well suited for preventing caches (browsers and proxies) * to cache the content of responses. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.3">rfc7234 section 5.2.2.3</a> */ public static CacheControl noStore() { CacheControl cc = new CacheControl(); cc.noStore = true; return cc; }
/** * Add a "no-cache" directive. * <p>This directive is well suited for telling caches that the response * can be reused only if the client revalidates it with the server. * This directive won't disable cache altogether and may result with clients * sending conditional requests (with "ETag", "If-Modified-Since" headers) * and the server responding with "304 - Not Modified" status. * <p>In order to disable caching and minimize requests/responses exchanges, * the {@link #noStore()} directive should be used instead of {@code #noCache()}. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a> */ public static CacheControl noCache() { CacheControl cc = new CacheControl(); cc.noCache = true; return cc; }
/** * Add a "no-cache" directive. * <p>This directive is well suited for telling caches that the response * can be reused only if the client revalidates it with the server. * This directive won't disable cache altogether and may result with clients * sending conditional requests (with "ETag", "If-Modified-Since" headers) * and the server responding with "304 - Not Modified" status. * <p>In order to disable caching and minimize requests/responses exchanges, * the {@link #noStore()} directive should be used instead of {@code #noCache()}. * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.2">rfc7234 section 5.2.2.2</a> */ public static CacheControl noCache() { CacheControl cc = new CacheControl(); cc.noCache = true; return cc; }
/** * Add a "max-age=" directive. * <p>This directive is well suited for publicly caching resources, knowing that * they won't change within the configured amount of time. Additional directives * can be also used, in case resources shouldn't be cached ({@link #cachePrivate()}) * or transformed ({@link #noTransform()}) by shared caches. * <p>In order to prevent caches to reuse the cached response even when it has * become stale (i.e. the "max-age" delay is passed), the "must-revalidate" * directive should be set ({@link #mustRevalidate()} * @param maxAge the maximum time the response should be cached * @param unit the time unit of the {@code maxAge} argument * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a> */ public static CacheControl maxAge(long maxAge, TimeUnit unit) { CacheControl cc = new CacheControl(); cc.maxAge = unit.toSeconds(maxAge); return cc; }
/** * Add a "max-age=" directive. * <p>This directive is well suited for publicly caching resources, knowing that * they won't change within the configured amount of time. Additional directives * can be also used, in case resources shouldn't be cached ({@link #cachePrivate()}) * or transformed ({@link #noTransform()}) by shared caches. * <p>In order to prevent caches to reuse the cached response even when it has * become stale (i.e. the "max-age" delay is passed), the "must-revalidate" * directive should be set ({@link #mustRevalidate()} * @param maxAge the maximum time the response should be cached * @param unit the time unit of the {@code maxAge} argument * @return {@code this}, to facilitate method chaining * @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a> */ public static CacheControl maxAge(long maxAge, TimeUnit unit) { CacheControl cc = new CacheControl(); cc.maxAge = unit.toSeconds(maxAge); return cc; }