er.extensions
Class ERXWOResponseCache
java.lang.Object
er.extensions.ERXWOResponseCache
- public class ERXWOResponseCache
- extends Object
The response cache is a way to cache WOResponse output from a DirectAction
for a given set of cache keys. You can specify the headers, formValues and cookies
to take into account. Your DirectAction class must implement the ERXWOResponseCache.Cacheable
interface and
should look like this:
public class DirectAction extends WODirectAction implements ERXWOResponseCache.Cacheable {
static {
ERXWOResponseCacheKeyPolicy.sharedInstance().createPolicyEntryForClass(DirectAction.class,
new NSArray(new Object[] {"default", "cached"}),
NSArray.EmptyArray, NSArray.EmptyArray, NSArray.EmptyArray);
}
public DirectAction(WORequest aRequest) {
super(aRequest);
}
public WOActionResults notCachedAction() {
return pageWithName("NotCached");
}
public WOActionResults cachedAction() {
return pageWithName("Cached");
}
public WOActionResults defaultAction() {
return pageWithName("Main");
}
}
You must also set the default er.extensions.ERXWOResponseCache.Enabled=true
for the cache to get used.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sharedInstance
protected static ERXWOResponseCache sharedInstance
- Holds a reference to the shared instance
NO_CACHE_KEY
public static String NO_CACHE_KEY
- Header key you can set in the response when creating an error page you don't want to get cached.
cache
protected Map cache
policy
protected ERXWOResponseCache.Policy policy
isEnabled
protected Boolean isEnabled
ERXWOResponseCache
public ERXWOResponseCache()
sharedInstance
public static ERXWOResponseCache sharedInstance()
- Gets the shared instance
- Returns:
- the shared instance
isEnabled
public boolean isEnabled()
setIsEnabled
public void setIsEnabled(boolean enabled)
policy
public ERXWOResponseCache.Policy policy()
setPolicy
public void setPolicy(ERXWOResponseCache.Policy policy)
hasPolicy
public boolean hasPolicy()
actionNameIsCachableForClass
public boolean actionNameIsCachableForClass(Class actionClass,
String actionName)
flushCache
public void flushCache()
cachedResponseForRequest
public WOResponse cachedResponseForRequest(Class actionClass,
String actionName,
WORequest request)
cacheResponseForRequest
public void cacheResponseForRequest(Class actionClass,
String actionName,
WORequest request,
WOResponse response)
Copyright © 2002 – 2004 Project Wonder.