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.
The newest version!
SpincastCacheHeadersRequestContextAddon (org.spincast:spincast-framework 0.9.28 API)
org.spincast.plugins.httpcaching
Class SpincastCacheHeadersRequestContextAddon<R extends IRequestContext<?>>
- java.lang.Object
-
- org.spincast.plugins.httpcaching.SpincastCacheHeadersRequestContextAddon<R>
-
- All Implemented Interfaces:
- ICacheHeadersRequestContextAddon<R>
public class SpincastCacheHeadersRequestContextAddon<R extends IRequestContext<?>>
extends Object
implements ICacheHeadersRequestContextAddon<R>
-
-
Field Summary
Fields
Modifier and Type
Field and Description
protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors
Constructor and Description
SpincastCacheHeadersRequestContextAddon(R requestContext,
IETagFactory etagFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods
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.
-
-
Constructor Detail
-
SpincastCacheHeadersRequestContextAddon
@Inject
public SpincastCacheHeadersRequestContextAddon(R requestContext,
IETagFactory etagFactory)
-
Method Detail
-
getRequestContext
protected R getRequestContext()
-
getEtagFactory
protected IETagFactory getEtagFactory()
-
getExchange
protected Object getExchange()
-
getETag
protected IETag getETag()
-
setETag
protected void setETag(IETag eTag)
-
isETagWeakComparison
protected boolean isETagWeakComparison()
-
setETagWeakComparison
protected void setETagWeakComparison(boolean eTagWeakComparison)
-
getLastModificationDate
protected Date getLastModificationDate()
-
setLastModificationDate
protected void setLastModificationDate(Date lastModificationDate)
-
eTag
public ICacheHeadersRequestContextAddon<R> eTag(String currentTag)
Description copied from interface: ICacheHeadersRequestContextAddon
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 ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
-
eTag
public ICacheHeadersRequestContextAddon<R> eTag(String currentTag,
boolean currentTagIsWeak)
Description copied from interface: ICacheHeadersRequestContextAddon
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 ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
-
eTag
public ICacheHeadersRequestContextAddon<R> eTag(String currentTag,
boolean currentTagIsWeak,
boolean weakComparison)
Description copied from interface: ICacheHeadersRequestContextAddon
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 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?
-
lastModified
public ICacheHeadersRequestContextAddon<R> lastModified(Date lastModificationDate)
Description copied from interface: ICacheHeadersRequestContextAddon
Specifies the last modification date of the resource.
Skip, or use null if the resource doesn't exist.
- Specified by:
lastModified in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
-
isEtagsFromIfMatchHeaderContainsAWildcard
protected boolean isEtagsFromIfMatchHeaderContainsAWildcard()
-
isEtagsFromIfNoneMatchHeaderContainsAWildcard
protected boolean isEtagsFromIfNoneMatchHeaderContainsAWildcard()
-
isIfMatchEtagMatches
protected boolean isIfMatchEtagMatches()
-
isIfNoneMatchEtagMatches
protected boolean isIfNoneMatchEtagMatches()
-
isEtagMatches
protected boolean isEtagMatches(IETag requestETag,
boolean weakComparison)
-
getDateFromIfModifiedSinceHeader
protected Date getDateFromIfModifiedSinceHeader()
-
getDateFromIfUnmodifiedSinceHeader
protected Date getDateFromIfUnmodifiedSinceHeader()
-
cache
public ICacheHeadersRequestContextAddon<R> cache(int seconds)
Description copied from interface: ICacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
-
cache
public ICacheHeadersRequestContextAddon<R> cache(int seconds,
boolean isPrivate)
Description copied from interface: ICacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
isPrivate - should the cache be 'private'?
(help)
-
cache
public ICacheHeadersRequestContextAddon<R> cache(int seconds,
boolean isPrivate,
Integer cdnSeconds)
Description copied from interface: ICacheHeadersRequestContextAddon
The number of seconds the client should cache this resource
before requesting it again.
- Specified by:
cache 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.
-
noCache
public SpincastCacheHeadersRequestContextAddon<R> noCache()
Description copied from interface: ICacheHeadersRequestContextAddon
Sends "No Cache" headers so the resource is not cached
at all by the client.
- Specified by:
noCache in interface ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
-
validate
public boolean validate(boolean resourceCurrentlyExists)
Description copied from interface: ICacheHeadersRequestContextAddon
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 ICacheHeadersRequestContextAddon<R extends IRequestContext<?>>
- Parameters:
resourceCurrentlyExists - Does the resource currently exist?
Copyright © 2016. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy