1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
52
52
public class CacheControl {
53
53
54
54
@ Nullable
55
- private Duration maxAge = null ;
55
+ private Duration maxAge ;
56
56
57
57
private boolean noCache = false ;
58
58
@@ -69,13 +69,13 @@ public class CacheControl {
69
69
private boolean proxyRevalidate = false ;
70
70
71
71
@ Nullable
72
- private Duration staleWhileRevalidate = null ;
72
+ private Duration staleWhileRevalidate ;
73
73
74
74
@ Nullable
75
- private Duration staleIfError = null ;
75
+ private Duration staleIfError ;
76
76
77
77
@ Nullable
78
- private Duration sMaxAge = null ;
78
+ private Duration sMaxAge ;
79
79
80
80
/**
81
81
* Create an empty CacheControl instance.
@@ -107,6 +107,7 @@ public static CacheControl empty() {
107
107
* @param maxAge the maximum time the response should be cached
108
108
* @param unit the time unit of the {@code maxAge} argument
109
109
* @return {@code this}, to facilitate method chaining
110
+ * @see #maxAge(Duration)
110
111
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a>
111
112
*/
112
113
public static CacheControl maxAge (long maxAge , TimeUnit unit ) {
@@ -124,6 +125,7 @@ public static CacheControl maxAge(long maxAge, TimeUnit unit) {
124
125
* directive should be set ({@link #mustRevalidate()}
125
126
* @param maxAge the maximum time the response should be cached
126
127
* @return {@code this}, to facilitate method chaining
128
+ * @since 5.2
127
129
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.8">rfc7234 section 5.2.2.8</a>
128
130
*/
129
131
public static CacheControl maxAge (Duration maxAge ) {
@@ -234,6 +236,7 @@ public CacheControl proxyRevalidate() {
234
236
* @param sMaxAge the maximum time the response should be cached
235
237
* @param unit the time unit of the {@code sMaxAge} argument
236
238
* @return {@code this}, to facilitate method chaining
239
+ * @see #sMaxAge(Duration)
237
240
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.9">rfc7234 section 5.2.2.9</a>
238
241
*/
239
242
public CacheControl sMaxAge (long sMaxAge , TimeUnit unit ) {
@@ -246,6 +249,7 @@ public CacheControl sMaxAge(long sMaxAge, TimeUnit unit) {
246
249
* by this directive overrides the maximum age specified by other directives.
247
250
* @param sMaxAge the maximum time the response should be cached
248
251
* @return {@code this}, to facilitate method chaining
252
+ * @since 5.2
249
253
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2.2.9">rfc7234 section 5.2.2.9</a>
250
254
*/
251
255
public CacheControl sMaxAge (Duration sMaxAge ) {
@@ -263,6 +267,7 @@ public CacheControl sMaxAge(Duration sMaxAge) {
263
267
* @param staleWhileRevalidate the maximum time the response should be used while being revalidated
264
268
* @param unit the time unit of the {@code staleWhileRevalidate} argument
265
269
* @return {@code this}, to facilitate method chaining
270
+ * @see #staleWhileRevalidate(Duration)
266
271
* @see <a href="https://tools.ietf.org/html/rfc5861#section-3">rfc5861 section 3</a>
267
272
*/
268
273
public CacheControl staleWhileRevalidate (long staleWhileRevalidate , TimeUnit unit ) {
@@ -278,6 +283,7 @@ public CacheControl staleWhileRevalidate(long staleWhileRevalidate, TimeUnit uni
278
283
* (i.e. without blocking).
279
284
* @param staleWhileRevalidate the maximum time the response should be used while being revalidated
280
285
* @return {@code this}, to facilitate method chaining
286
+ * @since 5.2
281
287
* @see <a href="https://tools.ietf.org/html/rfc5861#section-3">rfc5861 section 3</a>
282
288
*/
283
289
public CacheControl staleWhileRevalidate (Duration staleWhileRevalidate ) {
@@ -292,6 +298,7 @@ public CacheControl staleWhileRevalidate(Duration staleWhileRevalidate) {
292
298
* @param staleIfError the maximum time the response should be used when errors are encountered
293
299
* @param unit the time unit of the {@code staleIfError} argument
294
300
* @return {@code this}, to facilitate method chaining
301
+ * @see #staleIfError(Duration)
295
302
* @see <a href="https://tools.ietf.org/html/rfc5861#section-4">rfc5861 section 4</a>
296
303
*/
297
304
public CacheControl staleIfError (long staleIfError , TimeUnit unit ) {
@@ -304,6 +311,7 @@ public CacheControl staleIfError(long staleIfError, TimeUnit unit) {
304
311
* MAY be used to satisfy the request, regardless of other freshness information.
305
312
* @param staleIfError the maximum time the response should be used when errors are encountered
306
313
* @return {@code this}, to facilitate method chaining
314
+ * @since 5.2
307
315
* @see <a href="https://tools.ietf.org/html/rfc5861#section-4">rfc5861 section 4</a>
308
316
*/
309
317
public CacheControl staleIfError (Duration staleIfError ) {
0 commit comments