Package org.spincast.core.exchange
Interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
- All Known Implementing Classes:
SpincastCacheHeadersRequestContextAddon
public interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
Request context add-on to work with cache headers.
-
Method Summary
Modifier and TypeMethodDescriptioncache
(int seconds) The number of seconds the client should cache this resource before requesting it again.cache
(int seconds, boolean isPrivate) The number of seconds the client should cache this resource before requesting it again.The number of seconds the client should cache this resource before requesting it again.Specifies the current ETag (strong) of the resource.Specifies the current strong or weak ETag of the resource.Specifies the current strong or weak ETag of the resource.lastModified
(Date lastModificationDate) Specifies the last modification date of the resource.noCache()
Sends "No Cache" headers so the resource is not cached at all by the client.boolean
validate
(boolean resourceCurrentlyExists) Call this when you are done settingETag
and/orLast-Modified
to validate them agains the headers sent by the client.
-
Method Details
-
eTag
Specifies the current ETag (strong) of the resource.A strong comparison will be used to compare the request ETag to this current ETag.
Skip, or use
null
if the resource doesn't exist. -
eTag
Specifies the current strong or weak ETag of the resource.A strong comparison will be used to compare the request ETag to this current ETag.
Skip, or use
null
if the resource doesn't exist. -
eTag
CacheHeadersRequestContextAddon<R> eTag(String currentTag, boolean currentTagIsWeak, boolean weakComparison) Specifies the current strong or weak ETag of the resource.Skip, or use
null
if the resource doesn't exist.- Parameters:
weakComparison
- should a weak comparison be used instead of a strong one to compare the request ETag to the current ETag?
-
lastModified
Specifies the last modification date of the resource.Skip, or use
null
if the resource doesn't exist. -
cache
The number of seconds the client should cache this resource before requesting it again. -
cache
The number of seconds the client should cache this resource before requesting it again.- Parameters:
isPrivate
- should the cache be 'private'? (help)
-
cache
The number of seconds the client should cache this resource before requesting it again.- Parameters:
isPrivate
- should the cache be 'private'? (help)secondsCdn
- The number of seconds the resource associated with this route should be cached by a CDN/proxy. Ifnull
, it won't be used.
-
noCache
CacheHeadersRequestContextAddon<R> noCache()Sends "No Cache" headers so the resource is not cached at all by the client. -
validate
boolean validate(boolean resourceCurrentlyExists) Call this when you are done settingETag
and/orLast-Modified
to validate them agains the headers sent by the client.If this method returns
true
, the route handler should return immediately without returning/creating/modifying/deleting the associated resource! Appropriate headers have already been set on the response.- Parameters:
resourceCurrentlyExists
- Does the resource currently exist?
-