public class CacheControl
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.String> |
cacheExtension |
private static RuntimeDelegate.HeaderDelegate<CacheControl> |
HEADER_DELEGATE |
private int |
maxAge |
private boolean |
mustRevalidate |
private boolean |
noCache |
private java.util.List<java.lang.String> |
noCacheFields |
private boolean |
noStore |
private boolean |
noTransform |
private java.util.List<java.lang.String> |
privateFields |
private boolean |
privateFlag |
private boolean |
proxyRevalidate |
private int |
sMaxAge |
Constructor and Description |
---|
CacheControl()
Create a new instance of CacheControl.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares object argument to this cache control to see if they are the same
considering all property values.
|
java.util.Map<java.lang.String,java.lang.String> |
getCacheExtension()
Corresponds to a set of extension cache control directives.
|
int |
getMaxAge()
Corresponds to the max-age cache control directive.
|
java.util.List<java.lang.String> |
getNoCacheFields()
Corresponds to the value of the no-cache cache control directive.
|
java.util.List<java.lang.String> |
getPrivateFields()
Corresponds to the value of the private cache control directive.
|
int |
getSMaxAge()
Corresponds to the s-maxage cache control directive.
|
int |
hashCode()
Generate hash code from cache control properties.
|
private static int |
hashCodeOf(java.util.Collection<?> instance)
Compute a
Object.hashCode() of a collection. |
private static int |
hashCodeOf(java.util.Map<?,?> instance)
Compute a
Object.hashCode() of a map. |
boolean |
isMustRevalidate()
Corresponds to the must-revalidate cache control directive.
|
boolean |
isNoCache()
Corresponds to the no-cache cache control directive.
|
boolean |
isNoStore()
Corresponds to the no-store cache control directive.
|
boolean |
isNoTransform()
Corresponds to the no-transform cache control directive.
|
boolean |
isPrivate()
Corresponds to the private cache control directive.
|
boolean |
isProxyRevalidate()
Corresponds to the proxy-revalidate cache control directive.
|
private static boolean |
notEqual(java.util.Collection<?> first,
java.util.Collection<?> second)
Check if two collections are not equal.
|
private static boolean |
notEqual(java.util.Map<?,?> first,
java.util.Map<?,?> second)
Check if two maps are not equal.
|
void |
setMaxAge(int maxAge)
Corresponds to the max-age cache control directive.
|
void |
setMustRevalidate(boolean mustRevalidate)
Corresponds to the must-revalidate cache control directive.
|
void |
setNoCache(boolean noCache)
Corresponds to the no-cache cache control directive.
|
void |
setNoStore(boolean noStore)
Corresponds to the no-store cache control directive.
|
void |
setNoTransform(boolean noTransform)
Corresponds to the no-transform cache control directive.
|
void |
setPrivate(boolean flag)
Corresponds to the private cache control directive.
|
void |
setProxyRevalidate(boolean proxyRevalidate)
Corresponds to the must-revalidate cache control directive.
|
void |
setSMaxAge(int sMaxAge)
Corresponds to the s-maxage cache control directive.
|
java.lang.String |
toString()
Convert the cache control to a string suitable for use as the value of the
corresponding HTTP header.
|
static CacheControl |
valueOf(java.lang.String value)
Creates a new instance of CacheControl by parsing the supplied string.
|
private static final RuntimeDelegate.HeaderDelegate<CacheControl> HEADER_DELEGATE
private java.util.List<java.lang.String> privateFields
private java.util.List<java.lang.String> noCacheFields
private java.util.Map<java.lang.String,java.lang.String> cacheExtension
private boolean privateFlag
private boolean noCache
private boolean noStore
private boolean noTransform
private boolean mustRevalidate
private boolean proxyRevalidate
private int maxAge
private int sMaxAge
public CacheControl()
public static CacheControl valueOf(java.lang.String value)
value
- the cache control stringjava.lang.IllegalArgumentException
- if the supplied string cannot be parsed
or is nullpublic boolean isMustRevalidate()
public void setMustRevalidate(boolean mustRevalidate)
mustRevalidate
- true if the must-revalidate cache control directive should be included in the
response, false otherwise.public boolean isProxyRevalidate()
public void setProxyRevalidate(boolean proxyRevalidate)
proxyRevalidate
- true if the proxy-revalidate cache control directive should be included in the
response, false otherwise.public int getMaxAge()
public void setMaxAge(int maxAge)
maxAge
- the value of the max-age cache control directive, a value of -1 will disable the directive.public int getSMaxAge()
public void setSMaxAge(int sMaxAge)
sMaxAge
- the value of the s-maxage cache control directive, a value of -1 will disable the directive.public java.util.List<java.lang.String> getNoCacheFields()
isNoCache()
,
setNoCache(boolean)
,
HTTP/1.1 section 14.9.1public void setNoCache(boolean noCache)
noCache
- true if the no-cache cache control directive should be included in the
response, false otherwise.getNoCacheFields()
,
HTTP/1.1 section 14.9.1public boolean isNoCache()
getNoCacheFields()
,
HTTP/1.1 section 14.9.1public boolean isPrivate()
getPrivateFields()
,
HTTP/1.1 section 14.9.1public java.util.List<java.lang.String> getPrivateFields()
isPrivate()
,
setPrivate(boolean)
,
HTTP/1.1 section 14.9.1public void setPrivate(boolean flag)
flag
- true if the private cache control directive should be included in the
response, false otherwise.getPrivateFields()
,
HTTP/1.1 section 14.9.1public boolean isNoTransform()
public void setNoTransform(boolean noTransform)
noTransform
- true if the no-transform cache control directive should be included in the
response, false otherwise.public boolean isNoStore()
public void setNoStore(boolean noStore)
noStore
- true if the no-store cache control directive should be included in the
response, false otherwise.public java.util.Map<java.lang.String,java.lang.String> getCacheExtension()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare toprivate static boolean notEqual(java.util.Collection<?> first, java.util.Collection<?> second)
null
and the other is empty, consider the collections to be equal.first
- first collection. May be null
.second
- second collection. May be null
.true
if the two collections are not equal, false
if the two collections are equal
(or one of them is null
and the other one is empty).private static boolean notEqual(java.util.Map<?,?> first, java.util.Map<?,?> second)
null
and the other is empty, consider the maps to be equal.first
- first collection. May be null
.second
- second collection. May be null
.true
if the two maps are not equal, false
if the two maps are equal
(or one of them is null
and the other one is empty).private static int hashCodeOf(java.util.Collection<?> instance)
Object.hashCode()
of a collection.
If the collection is null
or empty, the returned hash code is 0
(zero). Otherwise, the collection's
hashCode()
method is called to compute the hash code.instance
- collection, may be null
.null
or empty, the returned hash code is 0
(zero).private static int hashCodeOf(java.util.Map<?,?> instance)
Object.hashCode()
of a map.
If the map is null
or empty, the returned hash code is 0
(zero). Otherwise, the map's
hashCode()
method is called to compute the hash code.instance
- map, may be null
.null
or empty, the returned hash code is 0
(zero).