|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.scmwebgui.AbstractCacheFilter
public abstract class AbstractCacheFilter
This class is a Servlet 2.3 filter that caches responses that match a given
criteria. This abstract class must be extended to define
shouldCache(HttpServletRequest)
, that chooses whether or not cache
the response asociated to the incoming request
Field Summary | |
---|---|
static java.lang.String |
CACHE_CLEAN_PERIOD_INIT_PARAM
Cache period to clean |
static java.lang.String |
CACHE_DIRECTORY_INIT_PARAM
Cache directory initialization parameter |
static java.lang.String |
CACHE_TIME_OF_LIFE_INIT_PARAM
Content lifetime in cache |
protected javax.servlet.ServletContext |
ctx
|
Constructor Summary | |
---|---|
AbstractCacheFilter()
Default constructor |
Method Summary | |
---|---|
void |
destroy()
Called by the servlet container when the app is being destroyed. |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Determines applies the cache or not, depending on the user request and shouldCache(HttpServletRequest) |
protected abstract java.lang.String |
getCachedFilePath(RequestContext reqCtx)
Subclasses must override this method to specify the mapping between context URIs and paths to cached files |
void |
init(javax.servlet.FilterConfig cfg)
Initializes this filter |
protected void |
invalidateCache(java.lang.String path,
boolean recursive)
Invalidates cache |
protected void |
invalidateContentCache(java.lang.String path)
|
protected abstract boolean |
shouldCache(javax.servlet.http.HttpServletRequest req)
Subclases must override this method to define the criteria for caching the response, given a user request |
protected abstract boolean |
shouldRefresh(javax.servlet.http.HttpServletRequest req)
Subclasses must override this method to return whether a cached request should be refreshed or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CACHE_DIRECTORY_INIT_PARAM
public static final java.lang.String CACHE_CLEAN_PERIOD_INIT_PARAM
public static final java.lang.String CACHE_TIME_OF_LIFE_INIT_PARAM
protected javax.servlet.ServletContext ctx
Constructor Detail |
---|
public AbstractCacheFilter()
Method Detail |
---|
public void init(javax.servlet.FilterConfig cfg) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
cfg
-
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
shouldCache(HttpServletRequest)
doFilter
in interface javax.servlet.Filter
request
- response
- chain
-
java.io.IOException
javax.servlet.ServletException
protected abstract boolean shouldRefresh(javax.servlet.http.HttpServletRequest req)
req
-
protected void invalidateCache(java.lang.String path, boolean recursive)
path
- protected void invalidateContentCache(java.lang.String path)
protected abstract java.lang.String getCachedFilePath(RequestContext reqCtx)
ctxURI
-
protected abstract boolean shouldCache(javax.servlet.http.HttpServletRequest req)
req
- The user request
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |