public class SpincastCacheHeadersRequestContextAddon<R extends IRequestContext<?>> extends Object implements ICacheHeadersRequestContextAddon<R>
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastCacheHeadersRequestContextAddon(R requestContext,
IETagFactory etagFactory) |
| Modifier and Type | Method and Description |
|---|---|
ICacheHeadersRequestContextAddon<R> |
cache(int seconds)
The number of seconds the client should cache this resource
before requesting it again.
|
ICacheHeadersRequestContextAddon<R> |
cache(int seconds,
boolean isPrivate)
The number of seconds the client should cache this resource
before requesting it again.
|
ICacheHeadersRequestContextAddon<R> |
cache(int seconds,
boolean isPrivate,
Integer cdnSeconds)
The number of seconds the client should cache this resource
before requesting it again.
|
ICacheHeadersRequestContextAddon<R> |
eTag(String currentTag)
Specifies the current ETag (strong) of the resource.
|
ICacheHeadersRequestContextAddon<R> |
eTag(String currentTag,
boolean currentTagIsWeak)
Specifies the current strong or weak ETag of the resource.
|
ICacheHeadersRequestContextAddon<R> |
eTag(String currentTag,
boolean currentTagIsWeak,
boolean weakComparison)
Specifies the current strong or weak ETag of the resource.
|
protected String |
formatDateForHttpHeader(Date date) |
protected Date |
getDateFromIfModifiedSinceHeader() |
protected Date |
getDateFromIfUnmodifiedSinceHeader() |
protected IETag |
getETag() |
protected IETagFactory |
getEtagFactory() |
List<IETag> |
getEtagsFromIfMatchHeader() |
List<IETag> |
getEtagsFromIfNoneMatchHeader() |
protected Object |
getExchange() |
protected Date |
getLastModificationDate() |
protected R |
getRequestContext() |
protected boolean |
isEtagMatches(IETag requestETag,
boolean weakComparison) |
protected boolean |
isEtagsFromIfMatchHeaderContainsAWildcard() |
protected boolean |
isEtagsFromIfNoneMatchHeaderContainsAWildcard() |
protected boolean |
isETagWeakComparison() |
protected boolean |
isIfMatchEtagMatches() |
protected boolean |
isIfNoneMatchEtagMatches() |
ICacheHeadersRequestContextAddon<R> |
lastModified(Date lastModificationDate)
Specifies the last modification date of the resource.
|
SpincastCacheHeadersRequestContextAddon<R> |
noCache()
Sends "No Cache" headers so the resource is not cached
at all by the client.
|
protected void |
setETag(IETag eTag) |
protected void |
setETagWeakComparison(boolean eTagWeakComparison) |
protected void |
setLastModificationDate(Date lastModificationDate) |
boolean |
validate(boolean resourceCurrentlyExists)
Call this when you are done setting
ETag and/or Last-Modified to validate
them agains the headers sent by the client. |
@Inject public SpincastCacheHeadersRequestContextAddon(R requestContext, IETagFactory etagFactory)
protected R getRequestContext()
protected IETagFactory getEtagFactory()
protected Object getExchange()
protected IETag getETag()
protected void setETag(IETag eTag)
protected boolean isETagWeakComparison()
protected void setETagWeakComparison(boolean eTagWeakComparison)
protected Date getLastModificationDate()
protected void setLastModificationDate(Date lastModificationDate)
public ICacheHeadersRequestContextAddon<R> eTag(String currentTag)
ICacheHeadersRequestContextAddonA 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 in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>public ICacheHeadersRequestContextAddon<R> eTag(String currentTag, boolean currentTagIsWeak)
ICacheHeadersRequestContextAddonA 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 in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>public ICacheHeadersRequestContextAddon<R> eTag(String currentTag, boolean currentTagIsWeak, boolean weakComparison)
ICacheHeadersRequestContextAddon
Skip, or use null if the resource doesn't exist.
eTag in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>weakComparison - should a weak comparison be used instead of
a strong one to compare the request ETag to the current ETag?public ICacheHeadersRequestContextAddon<R> lastModified(Date lastModificationDate)
ICacheHeadersRequestContextAddon
Skip, or use null if the resource doesn't exist.
lastModified in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>protected boolean isEtagsFromIfMatchHeaderContainsAWildcard()
protected boolean isEtagsFromIfNoneMatchHeaderContainsAWildcard()
protected boolean isIfMatchEtagMatches()
protected boolean isIfNoneMatchEtagMatches()
protected boolean isEtagMatches(IETag requestETag, boolean weakComparison)
protected Date getDateFromIfModifiedSinceHeader()
protected Date getDateFromIfUnmodifiedSinceHeader()
public ICacheHeadersRequestContextAddon<R> cache(int seconds)
ICacheHeadersRequestContextAddoncache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>public ICacheHeadersRequestContextAddon<R> cache(int seconds, boolean isPrivate)
ICacheHeadersRequestContextAddoncache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>isPrivate - should the cache be 'private'?
(help)public ICacheHeadersRequestContextAddon<R> cache(int seconds, boolean isPrivate, Integer cdnSeconds)
ICacheHeadersRequestContextAddoncache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>isPrivate - should the cache be 'private'?
(help)cdnSeconds - The number of seconds the resource associated with
this route should be cached by a CDN/proxy. If null, it
won't be used.public SpincastCacheHeadersRequestContextAddon<R> noCache()
ICacheHeadersRequestContextAddonnoCache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>public boolean validate(boolean resourceCurrentlyExists)
ICacheHeadersRequestContextAddonETag and/or Last-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.
validate in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>resourceCurrentlyExists - Does the resource currently exist?Copyright © 2016. All rights reserved.