Package com.sun.appserv.web.cache
Class DefaultCacheHelper
- java.lang.Object
-
- com.sun.appserv.web.cache.DefaultCacheHelper
-
- All Implemented Interfaces:
CacheHelper
public class DefaultCacheHelper extends Object implements CacheHelper
DefaultCacheHelper interface is the built-in implementation of theCacheHelperinterface to aide in: a) the key generation b) whether to cache the response. There is one CacheHelper instance per web application.
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CACHING_FILTER_NAMEstatic StringPROP_KEY_GENERATOR_ATTR_NAME-
Fields inherited from interface com.sun.appserv.web.cache.CacheHelper
ATTR_CACHE_MAPPED_SERVLET_NAME, ATTR_CACHE_MAPPED_URL_PATTERN, TIMEOUT_VALUE_NOT_SET
-
-
Constructor Summary
Constructors Constructor Description DefaultCacheHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Stop this Context component.StringgetCacheKey(jakarta.servlet.http.HttpServletRequest request)getCacheKey: generate the key to be used to cache this requestintgetTimeout(jakarta.servlet.http.HttpServletRequest request)get timeout for the cacheable data in this requestvoidinit(jakarta.servlet.ServletContext context, Map<String,String> props)initialize this helperbooleanisCacheable(jakarta.servlet.http.HttpServletRequest request)isCacheable: is the response to given request cachebale?booleanisRefreshNeeded(jakarta.servlet.http.HttpServletRequest request)isRefreshNeeded: is the response to given request be refreshed?voidsetCacheManager(CacheManager manager)set the CacheManager for this application
-
-
-
Field Detail
-
ATTR_CACHING_FILTER_NAME
public static final String ATTR_CACHING_FILTER_NAME
- See Also:
- Constant Field Values
-
PROP_KEY_GENERATOR_ATTR_NAME
public static final String PROP_KEY_GENERATOR_ATTR_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setCacheManager
public void setCacheManager(CacheManager manager)
set the CacheManager for this application- Parameters:
manager- associated with this application
-
init
public void init(jakarta.servlet.ServletContext context, Map<String,String> props)initialize this helper- Specified by:
initin interfaceCacheHelper- Parameters:
context- the web application context this helper belongs toprops- helper properties
-
getCacheKey
public String getCacheKey(jakarta.servlet.http.HttpServletRequest request)
getCacheKey: generate the key to be used to cache this request- Specified by:
getCacheKeyin interfaceCacheHelper- Parameters:
request- incomingHttpServletRequest- Returns:
- key string used to access the cache entry. Key is composed of: servletPath + a concatenation of the field values in the request; all key field names must be found in the appropriate scope.
-
isCacheable
public boolean isCacheable(jakarta.servlet.http.HttpServletRequest request)
isCacheable: is the response to given request cachebale?- Specified by:
isCacheablein interfaceCacheHelper- Parameters:
request- incomingHttpServletRequestobject- Returns:
trueif the response could be cached. or returnfalseif the results of this request must not be cached. Applies pre-configured cacheability constraints in the cache-mapping; all constraints must pass for this to be cacheable.
-
isRefreshNeeded
public boolean isRefreshNeeded(jakarta.servlet.http.HttpServletRequest request)
isRefreshNeeded: is the response to given request be refreshed?- Specified by:
isRefreshNeededin interfaceCacheHelper- Parameters:
request- incomingHttpServletRequestobject- Returns:
trueif the response needs to be refreshed. or returnfalseif the results of this request don't need to be refreshed. XXX: 04/16/02 right now there is no configurability for this in ias-web.xml; should add a refresh-field element there:
-
getTimeout
public int getTimeout(jakarta.servlet.http.HttpServletRequest request)
get timeout for the cacheable data in this request- Specified by:
getTimeoutin interfaceCacheHelper- Parameters:
request- incomingHttpServletRequestobject- Returns:
- either the statically specified value or from the request fields. If not specified, get the timeout defined for the cache element.
-
destroy
public void destroy() throws ExceptionStop this Context component.- Specified by:
destroyin interfaceCacheHelper- Throws:
Exception- if a shutdown error occurs
-
-