org.riotfamily.website.view
Class CacheableViewController

java.lang.Object
  extended by org.riotfamily.website.view.ConfigurableViewController
      extended by org.riotfamily.website.view.CacheableViewController
All Implemented Interfaces:
CacheableController, Controller
Direct Known Subclasses:
CacheablePageController

public class CacheableViewController
extends ConfigurableViewController
implements CacheableController


Field Summary
 
Fields inherited from interface org.riotfamily.cachius.spring.CacheableController
CACHE_ETERNALLY
 
Constructor Summary
CacheableViewController()
           
 
Method Summary
protected  void appendCacheKey(StringBuffer key, HttpServletRequest request)
          Subclasses may overwrite this method to append values to the cache-key.
protected  boolean bypassCache(HttpServletRequest request)
          Whether the cache should be bypassed for the given request.
 String getCacheKey(HttpServletRequest request)
          Returns the key that is used to look up a previously cached version.
 long getLastModified(HttpServletRequest request)
          The default implementation returns System.currentTimeMillis() so that the item is refreshed as soon as it expires.
 long getTimeToLive()
          The default implementation always returns CACHE_ETERNALLY.
 
Methods inherited from class org.riotfamily.website.view.ConfigurableViewController
handleRequest, populateModel, setContentType, setViewName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.web.servlet.mvc.Controller
handleRequest
 

Constructor Detail

CacheableViewController

public CacheableViewController()
Method Detail

getTimeToLive

public long getTimeToLive()
The default implementation always returns CACHE_ETERNALLY.

Specified by:
getTimeToLive in interface CacheableController

getLastModified

public long getLastModified(HttpServletRequest request)
The default implementation returns System.currentTimeMillis() so that the item is refreshed as soon as it expires.

Specified by:
getLastModified in interface CacheableController

bypassCache

protected boolean bypassCache(HttpServletRequest request)
Whether the cache should be bypassed for the given request. The default implementation always returns false.


getCacheKey

public String getCacheKey(HttpServletRequest request)
Description copied from interface: CacheableController
Returns the key that is used to look up a previously cached version. The key must include all values that govern the output, such as the requested URL, parameters, attributes, cookie values or the name of the controller. The key itself is not interpreted in any way and thus can have an arbitrary format.

Specified by:
getCacheKey in interface CacheableController

appendCacheKey

protected void appendCacheKey(StringBuffer key,
                              HttpServletRequest request)
Subclasses may overwrite this method to append values to the cache-key. The default implementation does nothing.