er.extensions.appserver
Class ERXWOResponseCache
java.lang.Object
er.extensions.appserver.ERXWOResponseCache
public class ERXWOResponseCache
- extends java.lang.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 java.lang.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 java.util.Map cache
policy
protected ERXWOResponseCache.Policy policy
isEnabled
protected java.lang.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(java.lang.Class actionClass,
java.lang.String actionName)
flushCache
public void flushCache()
cachedResponseForRequest
public com.webobjects.appserver.WOResponse cachedResponseForRequest(java.lang.Class actionClass,
java.lang.String actionName,
com.webobjects.appserver.WORequest request)
cacheResponseForRequest
public void cacheResponseForRequest(java.lang.Class actionClass,
java.lang.String actionName,
com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOResponse response)
Copyright © 2002 – 2007 Project Wonder.