|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.tagext.TagSupport | +--javax.servlet.jsp.tagext.BodyTagSupport | +--weblogicx.jsp.tags.CacheTag
The cache tag supports caching the work that is done within the body of the tag. To this end, it supports both output (transform) data and input (calculated) data. Output caching refers to the content generated by the code within the tag. Input caching refers to the values that variables are set to by the code within the tag. Output caching is useful when the final form of the content is the important thing to cache. Input caching is important when the view of the data can vary independently of the data calculated within the tag. The caches are stored using soft references to avoid the caching system from being responsible for running the system out of memory. Unfortunately, due to incompatibilities with the HotSpot's VM and the Classic VM, we must not use soft references when we are running within HotSpot. You can override the use of soft references by setting the following global system properties in precedence order: weblogicx.jsp.tags.CacheTag.softreferences = true|false weblogicx.jsp.tags.CacheTag.nosoftreferences = true|false Use of soft references defaults to true in a classic VM and false within a HotSpot VM. You can force the refresh of a cache by setting _cache_refresh to true in the scope that you want affected. If you want all caches to always refresh, put it in the application scope. If you want all the caches for a user to be refreshed, set it in the session scope. If you want all the caches in the current request to be refreshed set it as a parameter or in the request. Note: You must have the weblogic-tags-server.jar in your weblogic.class.path for proper operation.
Inner Class Summary | |
static class |
CacheTag.RefWrapper
|
Field Summary | |
protected java.lang.String |
actualKey
The actual key used to lookup the cache. |
protected java.lang.String |
additionalKey
|
protected java.util.Set |
currentLocks
|
protected java.util.Map |
savedPageContextValues
|
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id,
pageContext |
Constructor Summary | |
CacheTag()
Construction of a cache tag. |
Method Summary | |
protected void |
asyncForward()
|
int |
doAfterBody()
|
void |
doCatch(java.lang.Throwable t)
|
protected int |
doEndCache()
|
protected int |
doEndKeyedCache()
|
int |
doEndTag()
|
void |
doFinally()
|
protected int |
doStartCache()
|
protected int |
doStartKeyedCache()
|
int |
doStartTag()
Start the cache tag. |
protected void |
ensureAdmin(java.lang.String cacheKey)
|
protected java.lang.String |
getAdditionalKey()
|
static boolean |
getAdmin()
|
boolean |
getAsync()
|
static boolean |
getDebug()
|
java.lang.String |
getFlush()
|
java.lang.String |
getKey()
|
java.lang.String |
getName()
|
java.lang.String |
getScope()
|
protected java.lang.Object |
getScopeObject(java.lang.String scope)
|
int |
getSize()
|
java.lang.String |
getTimeout()
|
protected java.lang.Object |
getValueFromScope(java.lang.String scope,
java.lang.String key)
|
java.lang.String |
getVars()
|
static boolean |
getVerbose()
|
static void |
main(java.lang.String[] args)
|
void |
release()
If the tag fails in the middle or something else bad happens we need to destroy all the locks that were taken but not released to avoid deadlocking the next time we hit the cache. |
protected void |
releaseLock(java.lang.String scope,
java.lang.String key)
|
protected void |
removeValueInScope(java.lang.String scope,
java.lang.String key)
|
protected void |
restoreVars(CacheValue cache)
|
protected void |
revertKeysAfterCacheUpdate()
|
protected void |
revertKeysAfterForward()
|
protected void |
revertPageContextVariables()
|
protected void |
revertValues(java.util.Map revertedPageScope,
java.util.Map revertedRequestScope,
java.util.Map revertedSessionScope,
java.util.Map revertedApplicationScope)
|
protected void |
saveKeysBeforeCacheUpdate()
|
protected void |
saveKeysBeforeForward()
|
protected void |
saveVars(CacheValue cache)
|
static void |
setAdmin(boolean admin)
|
void |
setAsync(boolean async)
If the async parameter is true, the cache will be updated asynchronously, if possible. |
static void |
setDebug(boolean debug)
|
void |
setFlush(java.lang.String flush)
|
void |
setKey(java.lang.String key)
This is the name of the variable whose value you wish to use as a key into the cache. |
void |
setName(java.lang.String name)
This is a name for the cache that you can reference in other pages in order to use the same cache across pages. |
void |
setScope(java.lang.String scope)
This is the scope of the cache, i.e. |
void |
setSize(int size)
For keyed caches this limits the number of keys to keep. |
void |
setTimeout(java.lang.String timeoutString)
Cache timeout property. |
protected void |
setValueInScope(java.lang.String scope,
java.lang.String key,
java.lang.Object value)
|
void |
setVars(java.lang.String vars)
In addition to caching the transformed output of the cache, calculated values can also be cached within the block. |
static void |
setVerbose(boolean verbose)
|
protected boolean |
shouldRefresh()
|
protected void |
storeKeyValues(java.util.Map storePageScope,
java.util.Map storeRequestScope,
java.util.Map storeSessionScope,
java.util.Map storeApplicationScope)
|
protected boolean |
takeLock(java.lang.String scope,
java.lang.String key)
Returns false if you can only read, true if you got the lock. |
protected void |
waitOnLock(java.lang.String scope,
java.lang.String key)
Waits until the lock is released since another thread is calculating the cache value. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody,
getBodyContent,
getPreviousOut,
setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass,
getId,
getParent,
getValue,
getValues,
removeValue,
setId,
setPageContext,
setParent,
setValue |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String actualKey
protected java.util.Set currentLocks
protected java.lang.String additionalKey
protected java.util.Map savedPageContextValues
Constructor Detail |
public CacheTag()
Method Detail |
public static boolean getDebug()
public static void setDebug(boolean debug)
public static boolean getVerbose()
public static void setVerbose(boolean verbose)
public static boolean getAdmin()
public static void setAdmin(boolean admin)
public static void main(java.lang.String[] args)
public void setTimeout(java.lang.String timeoutString) throws javax.servlet.jsp.JspException
public java.lang.String getTimeout()
public void setScope(java.lang.String scope)
public java.lang.String getScope()
public void setName(java.lang.String name)
public java.lang.String getName()
public void setSize(int size)
public int getSize()
public void setKey(java.lang.String key)
public java.lang.String getKey()
public void setAsync(boolean async)
public boolean getAsync()
public void setVars(java.lang.String vars)
public java.lang.String getVars()
public void setFlush(java.lang.String flush)
public java.lang.String getFlush()
protected java.lang.Object getScopeObject(java.lang.String scope) throws javax.servlet.jsp.JspException
protected java.lang.Object getValueFromScope(java.lang.String scope, java.lang.String key) throws javax.servlet.jsp.JspException
protected void setValueInScope(java.lang.String scope, java.lang.String key, java.lang.Object value) throws javax.servlet.jsp.JspException
protected void removeValueInScope(java.lang.String scope, java.lang.String key) throws javax.servlet.jsp.JspException
public int doStartTag() throws javax.servlet.jsp.JspException
protected boolean takeLock(java.lang.String scope, java.lang.String key) throws javax.servlet.jsp.JspException
protected void waitOnLock(java.lang.String scope, java.lang.String key) throws javax.servlet.jsp.JspException
protected void releaseLock(java.lang.String scope, java.lang.String key) throws javax.servlet.jsp.JspException
protected boolean shouldRefresh()
protected java.lang.String getAdditionalKey() throws javax.servlet.jsp.JspException
protected void revertPageContextVariables()
protected void saveKeysBeforeForward() throws javax.servlet.jsp.JspException
protected void revertKeysAfterForward() throws javax.servlet.jsp.JspException
protected void saveKeysBeforeCacheUpdate() throws javax.servlet.jsp.JspException
protected void revertKeysAfterCacheUpdate() throws javax.servlet.jsp.JspException
protected void storeKeyValues(java.util.Map storePageScope, java.util.Map storeRequestScope, java.util.Map storeSessionScope, java.util.Map storeApplicationScope) throws javax.servlet.jsp.JspException
protected void revertValues(java.util.Map revertedPageScope, java.util.Map revertedRequestScope, java.util.Map revertedSessionScope, java.util.Map revertedApplicationScope) throws javax.servlet.jsp.JspException
protected void asyncForward() throws javax.servlet.jsp.JspException
protected void ensureAdmin(java.lang.String cacheKey)
protected int doStartCache() throws javax.servlet.jsp.JspException
protected int doStartKeyedCache() throws javax.servlet.jsp.JspException
public int doAfterBody() throws javax.servlet.jsp.JspException
protected int doEndCache() throws javax.servlet.jsp.JspException
protected int doEndKeyedCache() throws javax.servlet.jsp.JspException
public int doEndTag()
public void doCatch(java.lang.Throwable t) throws java.lang.Throwable
public void doFinally()
public void release()
protected void saveVars(CacheValue cache) throws javax.servlet.jsp.JspException
protected void restoreVars(CacheValue cache) throws javax.servlet.jsp.JspException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs61 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |