@ProviderType public final class CacheHeader extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isNotModified(ModificationDateProvider dateProvider,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
Compares the "If-Modified-Since header" of the incoming request with the last modification date of an aggregated
resource.
|
static boolean |
isNotModified(ModificationDateProvider dateProvider,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
boolean setExpiresHeader)
Compares the "If-Modified-Since header" of the incoming request with the last modification date of an aggregated
resource.
|
static boolean |
isNotModified(org.apache.sling.api.resource.Resource resource,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
Compares the "If-Modified-Since header" of the incoming request with the last modification date of a resource.
|
static boolean |
isNotModified(org.apache.sling.api.resource.Resource resource,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
boolean setExpiresHeader)
Compares the "If-Modified-Since header" of the incoming request with the last modification date of a resource.
|
static void |
setExpires(javax.servlet.http.HttpServletResponse response,
Date date)
Set expires header to given date.
|
static void |
setExpiresDays(javax.servlet.http.HttpServletResponse response,
int days)
Set expires header to given amount of days in the future.
|
static void |
setExpiresHours(javax.servlet.http.HttpServletResponse response,
int hours)
Set expires header to given amount of hours in the future.
|
static void |
setExpiresSeconds(javax.servlet.http.HttpServletResponse response,
int seconds)
Set expires header to given amount of seconds in the future.
|
static void |
setNonCachingHeaders(javax.servlet.http.HttpServletResponse response)
Set headers to disallow caching in browser, proxy servers and dispatcher for the current response.
|
public static boolean isNotModified(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException
Expires header is automatically set on author instance, and not set on publish instance.
resource
- the JCR resource the last modification date is taken fromrequest
- Requestresponse
- ResponseIOException
public static boolean isNotModified(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, boolean setExpiresHeader) throws IOException
resource
- the JCR resource the last modification date is taken fromrequest
- Requestresponse
- ResponsesetExpiresHeader
- Set expires header to -1 to ensure the browser checks for a new version on every request.IOException
public static boolean isNotModified(ModificationDateProvider dateProvider, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException
Expires header is automatically set on author instance, and not set on publish instance.
dateProvider
- abstraction layer that calculates the last-modification time of an aggregated resourcerequest
- Requestresponse
- ResponseIOException
public static boolean isNotModified(ModificationDateProvider dateProvider, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, boolean setExpiresHeader) throws IOException
dateProvider
- abstraction layer that calculates the last-modification time of an aggregated resourcerequest
- Requestresponse
- ResponsesetExpiresHeader
- Set expires header to -1 to ensure the browser checks for a new version on every request.IOException
public static void setNonCachingHeaders(javax.servlet.http.HttpServletResponse response)
response
- Current responsepublic static void setExpires(javax.servlet.http.HttpServletResponse response, Date date)
response
- Responsedate
- Expires datepublic static void setExpiresSeconds(javax.servlet.http.HttpServletResponse response, int seconds)
response
- Responseseconds
- Seconds to expirepublic static void setExpiresHours(javax.servlet.http.HttpServletResponse response, int hours)
response
- Responsehours
- Hours to expirepublic static void setExpiresDays(javax.servlet.http.HttpServletResponse response, int days)
response
- Responsedays
- Days to expireCopyright © 2014–2016 wcm.io. All rights reserved.