
public.javadoc.org.spincast.plugins.httpcaching.SpincastCacheHeadersRequestContextAddon.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastCacheHeadersRequestContextAddon (org.spincast:spincast-framework 2.1.1 API)
Package org.spincast.plugins.httpcaching
Class SpincastCacheHeadersRequestContextAddon<R extends RequestContext<?>>
java.lang.Object
org.spincast.plugins.httpcaching.SpincastCacheHeadersRequestContextAddon<R>
- All Implemented Interfaces:
CacheHeadersRequestContextAddon<R>
public class SpincastCacheHeadersRequestContextAddon<R extends RequestContext<?>>
extends Object
implements CacheHeadersRequestContextAddon<R>
-
Field Summary
Fields
-
Constructor Summary
Constructors
Constructor
Description
SpincastCacheHeadersRequestContextAddon(R requestContext,
ETagFactory etagFactory)
-
Method Summary
Modifier and Type
Method
Description
cache(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.
protected String
formatDateForHttpHeader(Date date)
protected Date
protected Date
protected ETag
getETag()
protected ETagFactory
protected Object
protected Date
protected R
protected boolean
isEtagMatches(ETag requestETag,
boolean weakComparison)
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
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.
protected void
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.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
Constructor Details
-
SpincastCacheHeadersRequestContextAddon
-
Method Details
-
getRequestContext
-
getEtagFactory
-
getExchange
-
getETag
-
setETag
-
isETagWeakComparison
protected boolean isETagWeakComparison()
-
setETagWeakComparison
protected void setETagWeakComparison(boolean eTagWeakComparison)
-
getLastModificationDate
-
setLastModificationDate
-
eTag
Description copied from interface: CacheHeadersRequestContextAddon
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.
- Specified by:
eTag
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
-
eTag
Description copied from interface: CacheHeadersRequestContextAddon
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.
- Specified by:
eTag
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
-
eTag
public CacheHeadersRequestContextAddon<R> eTag(String currentTag,
boolean currentTagIsWeak,
boolean weakComparison)
Description copied from interface: CacheHeadersRequestContextAddon
Specifies the current strong or weak ETag of the resource.
Skip, or use null
if the resource doesn't exist.
- Specified by:
eTag
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
weakComparison
- should a weak comparison be used instead of
a strong one to compare the request ETag to the current ETag?
-
lastModified
Description copied from interface: CacheHeadersRequestContextAddon
Specifies the last modification date of the resource.
Skip, or use null
if the resource doesn't exist.
- Specified by:
lastModified
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
-
isEtagsFromIfMatchHeaderContainsAWildcard
protected boolean isEtagsFromIfMatchHeaderContainsAWildcard()
-
getEtagsFromIfMatchHeader
-
getEtagsFromIfNoneMatchHeader
-
isEtagsFromIfNoneMatchHeaderContainsAWildcard
protected boolean isEtagsFromIfNoneMatchHeaderContainsAWildcard()
-
isIfMatchEtagMatches
protected boolean isIfMatchEtagMatches()
-
isIfNoneMatchEtagMatches
protected boolean isIfNoneMatchEtagMatches()
-
isEtagMatches
-
getDateFromIfModifiedSinceHeader
-
getDateFromIfUnmodifiedSinceHeader
-
formatDateForHttpHeader
-
cache
Description copied from interface: CacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
-
cache
Description copied from interface: CacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
isPrivate
- should the cache be 'private'?
(help)
-
cache
Description copied from interface: CacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
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.
-
noCache
Description copied from interface: CacheHeadersRequestContextAddon
Sends "No Cache" headers so the resource is not cached
at all by the client.
- Specified by:
noCache
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
-
validate
public boolean validate(boolean resourceCurrentlyExists)
Description copied from interface: CacheHeadersRequestContextAddon
Call this when you are done setting
ETag
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.
- Specified by:
validate
in interface CacheHeadersRequestContextAddon<R extends RequestContext<?>>
- Parameters:
resourceCurrentlyExists
- Does the resource currently exist?
© 2015 - 2025 Weber Informatics LLC | Privacy Policy